Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007: { Page } number not updating if within { IF... } statem
I have a VB programs that opens a Word document, mail merges to a new
document which is then printed. The problem is the { PAGE } number in the footer is not updating when the mail merge creates the new document if the { PAGE } field is within an { IF... } statement. This worked with Word 2000, but not with Word 2007. If I make the document visible as it is being updated, the document before the mail merge shows the page numbers correctly for each page, but the new document that is created will show page 1 for each page. Example that does not work: { IF { MERGEFIELD Property_State } = "VA" "Page { PAGE } of { NUMPAGES }" "" } Example that does work if not within an { IF... } statement: Page { PAGE } of { NUMPAGES } |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007: { Page } number not updating if within { IF... } statem
Under Word OptionsDisplayPrinting options, is the "Update fields before
printing" box checked? -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professional basis. "dbgeorge" wrote in message ... I have a VB programs that opens a Word document, mail merges to a new document which is then printed. The problem is the { PAGE } number in the footer is not updating when the mail merge creates the new document if the { PAGE } field is within an { IF... } statement. This worked with Word 2000, but not with Word 2007. If I make the document visible as it is being updated, the document before the mail merge shows the page numbers correctly for each page, but the new document that is created will show page 1 for each page. Example that does not work: { IF { MERGEFIELD Property_State } = "VA" "Page { PAGE } of { NUMPAGES }" "" } Example that does work if not within an { IF... } statement: Page { PAGE } of { NUMPAGES } |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007: { Page } number not updating if within { IF... } statem
Hi dbgeorge,
AFAIK, anything inside an IF test in a mailmerge document gets converted to the plain text results and this behaviour hasn't changed. -- Cheers macropod [Microsoft MVP - Word] "dbgeorge" wrote in message ... I have a VB programs that opens a Word document, mail merges to a new document which is then printed. The problem is the { PAGE } number in the footer is not updating when the mail merge creates the new document if the { PAGE } field is within an { IF... } statement. This worked with Word 2000, but not with Word 2007. If I make the document visible as it is being updated, the document before the mail merge shows the page numbers correctly for each page, but the new document that is created will show page 1 for each page. Example that does not work: { IF { MERGEFIELD Property_State } = "VA" "Page { PAGE } of { NUMPAGES }" "" } Example that does work if not within an { IF... } statement: Page { PAGE } of { NUMPAGES } |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007: { Page } number not updating if within { IF... } st
I set the option, but it made no difference.
"Doug Robbins - Word MVP" wrote: Under Word OptionsDisplayPrinting options, is the "Update fields before printing" box checked? -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professional basis. "dbgeorge" wrote in message ... I have a VB programs that opens a Word document, mail merges to a new document which is then printed. The problem is the { PAGE } number in the footer is not updating when the mail merge creates the new document if the { PAGE } field is within an { IF... } statement. This worked with Word 2000, but not with Word 2007. If I make the document visible as it is being updated, the document before the mail merge shows the page numbers correctly for each page, but the new document that is created will show page 1 for each page. Example that does not work: { IF { MERGEFIELD Property_State } = "VA" "Page { PAGE } of { NUMPAGES }" "" } Example that does work if not within an { IF... } statement: Page { PAGE } of { NUMPAGES } |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
{ PAGE } field within an { IF... } statement does not update during amail merge.
This has worked fine in Word 2000. We are upgrading to Office 2007, and this is one quirk we discovered. The document before the mail merge shows the correct page numbers, but sending to a new document resets all the pages to "1" if the page field is within an IF statement.
macropod wrote: Hi dbgeorge,AFAIK, anything inside an IF test in a mailmerge document gets 06-Nov-09 Hi dbgeorge, AFAIK, anything inside an IF test in a mailmerge document gets converted to the plain text results and this behaviour has not changed. -- Cheers macropod [Microsoft MVP - Word] Previous Posts In This Thread: EggHeadCafe - Software Developer Portal of Choice ASP.NET Handling Custom File Downloads http://www.eggheadcafe.com/tutorials...-custom-f.aspx |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007: { Page } number not updating if within { IF... } statem
I did some more testing. If I move this code out of the footer, it works
fine. So it is only within the footer that the page number does not update if it is within an IF statement. "dbgeorge" wrote: I have a VB programs that opens a Word document, mail merges to a new document which is then printed. The problem is the { PAGE } number in the footer is not updating when the mail merge creates the new document if the { PAGE } field is within an { IF... } statement. This worked with Word 2000, but not with Word 2007. If I make the document visible as it is being updated, the document before the mail merge shows the page numbers correctly for each page, but the new document that is created will show page 1 for each page. Example that does not work: { IF { MERGEFIELD Property_State } = "VA" "Page { PAGE } of { NUMPAGES }" "" } Example that does work if not within an { IF... } statement: Page { PAGE } of { NUMPAGES } |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
{ PAGE } field within an { IF... } statement does not update during amail merge.
I did some more testing. If I move the code out of the footer, the page number updates in the merged document.
Dan George wrote: { PAGE } field within an { IF... } statement does not update during a mail merge. 06-Nov-09 This has worked fine in Word 2000. We are upgrading to Office 2007, and this is one quirk we discovered. The document before the mail merge shows the correct page numbers, but sending to a new document resets all the pages to "1" if the page field is within an IF statement. Previous Posts In This Thread: EggHeadCafe - Software Developer Portal of Choice System.Xml.XmlSerializer Overview http://www.eggheadcafe.com/tutorials...erializer.aspx |
#8
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Word 2007: { Page } number not updating if within { IF... } statem
One more test. I put the code in the header and it fails. So the { PAGE }
field will update in an { IF... } statement if within the body of the document, but not within the header or the footer. "dbgeorge" wrote: I have a VB programs that opens a Word document, mail merges to a new document which is then printed. The problem is the { PAGE } number in the footer is not updating when the mail merge creates the new document if the { PAGE } field is within an { IF... } statement. This worked with Word 2000, but not with Word 2007. If I make the document visible as it is being updated, the document before the mail merge shows the page numbers correctly for each page, but the new document that is created will show page 1 for each page. Example that does not work: { IF { MERGEFIELD Property_State } = "VA" "Page { PAGE } of { NUMPAGES }" "" } Example that does work if not within an { IF... } statement: Page { PAGE } of { NUMPAGES } |
#9
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
{ PAGE } field within an { IF... } statement does not update during amail merge.
One more test. I put the code in the header and it fails. So the { PAGE } field will update in an { IF... } statement if within the body of the document, but not within the header or the footer.
Dan George wrote: { PAGE } field within an { IF... } statement does not update during a mail merge. 06-Nov-09 I did some more testing. If I move the code out of the footer, the page number updates in the merged document. Previous Posts In This Thread: EggHeadCafe - Software Developer Portal of Choice Integrate Windows Live ID Authentication with ASP.NET Membership, Profiles and Roles http://www.eggheadcafe.com/tutorials...s-live-id.aspx |
#10
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
{ PAGE } field within an { IF... } statement does not updateduring a mail merge.
I had to look back through the Word versions to check this, but as far
as I can tell, the behaviour is as you say: a. in Word 2000 - i.e., the result of the IF is "{ PAGE } of { NUMPAGES }" or "" b. in Word XP and later, the result of the IF is the fully resolved "1 of 1" or "" c. However, (b) is true whether the IF is in the header/footer or in the body. So I think the only reason you are gettina more sensible result in the body is because the correct value of PAGE is used each time the IF field is resolved. When the IF is in the header, I think Word uses the values of { PAGE } and { NUMPAGES } at the point where it evaluates the header/footer, and the problem with that is that the header is the same for all pages in the section - i.e. you get page 1 for every page. The only way I can think of that might get around this is to use the much nastier: { PAGE \#"{ IF { MERGEFIELD Property_State } = "VA" "'Page '0' of '" "" }"}{ NUMPAGES \#"{ IF { MERGEFIELD Property_State } = "VA" "0" "" }" } and since I haven't tested thoroughly, I'm not certain that will work either. Peter Jamieson http://tips.pjmsn.me.uk On 06/11/2009 15:58, Dan George wrote: One more test. I put the code in the header and it fails. So the { PAGE } field will update in an { IF... } statement if within the body of the document, but not within the header or the footer. Dan George wrote: { PAGE } field within an { IF... } statement does not update during a mail merge. 06-Nov-09 I did some more testing. If I move the code out of the footer, the page number updates in the merged document. Previous Posts In This Thread: EggHeadCafe - Software Developer Portal of Choice Integrate Windows Live ID Authentication with ASP.NET Membership, Profiles and Roles http://www.eggheadcafe.com/tutorials...s-live-id.aspx |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Page number x of y not updating in Header with Word 2007 | Microsoft Word Help | |||
unable to add page number using word 2007 template number missing | Microsoft Word Help | |||
Updating table of content for page number only | Microsoft Word Help | |||
How to use mailmerge feature to generate report? (i.e. SQL statem | Mailmerge | |||
How do I find a template for making my own college mission statem. | Page Layout |