Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dbgeorge dbgeorge is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dbgeorge dbgeorge is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Dan George Dan George is offline
external usenet poster
 
Posts: 3
Default { 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dbgeorge dbgeorge is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Dan George Dan George is offline
external usenet poster
 
Posts: 3
Default { 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dbgeorge dbgeorge is offline
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Dan George Dan George is offline
external usenet poster
 
Posts: 3
Default { 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default { 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Page number x of y not updating in Header with Word 2007 PcJunkie7 Microsoft Word Help 1 January 29th 09 10:28 AM
unable to add page number using word 2007 template number missing deemuk Microsoft Word Help 6 November 24th 08 02:17 PM
Updating table of content for page number only Rahul Microsoft Word Help 2 May 2nd 07 07:22 AM
How to use mailmerge feature to generate report? (i.e. SQL statem will~ Mailmerge 1 April 11th 06 09:25 AM
How do I find a template for making my own college mission statem. dasgilly Page Layout 0 March 15th 05 10:03 AM


All times are GMT +1. The time now is 01:16 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"