Invisible Multiple Fields in PageHeaders (Word 2003)

R

Roberto Villa Real

In Word 2000 or 97, the following fields used to work fine, even INSIDE THE
PAGEHEADER:

{if
{DOCVARIABLE X \ *MERGEFORMAT} <>"." (condition)
{QUOTE {DOCVARIABLE X \*MERGEFORMAT} \@ "dd/mm/yy" \*MERGEFORMAT} (show this
if true)
{DATE \@ "dd/mm/yy" \*MERGEFORMAT} (show this if False)
}

If the variable X is ".", the fields show the actual Date.
If X is different (like X ="01/06/2005"), the fields show X in "dd/mm/yy"
format (so the result would be "01/06/05")

But (only) in Word 2003, and (only) if these fields are in the pageheader
(or footer), it simply show NOTHING when the condition is false (it should
show the Docvariable X in "dd/mm/yy" format)...
I´ve tested several other simplier IF fields in the pageheader, and they
result in "" (blank) only in Word 2003. Can someone help?
 
D

Doug Robbins

Sounds like the fields are not being updated. Check the Update fields item
under Tools>Options>Print. Then use Print Preview.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
R

Roberto Villa Real

Thanks for your answer...
But, the problem is not with the printings... The fields, when updated,
simply disappear in the screen, as well as in it´s printing.

Having tested it for several times, i concluded:

"IF" Fields, when reffering to other fields (Date, DocVariables, etc), do
not work when you put them inside the PageHeader, but only in Word 2003.

If you want to see it with your own eyes, i could send you a copy of this
document by email.

I think I´m right when I say that the problem is with Word2003, but I´d
preffer to be wrong, cause many people have been using the documents I
developed, and I´ll have to work hard to modify all of them to be used with
Word 2003.

Thanks a lot,
Roberto Villa Real



"Doug Robbins" escreveu:
 
D

Doug Robbins

Please send me a copy of the document and I will check it out.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins

Hi Roberto,

Using Word 2003 and the document that you sent to me, when I run a macro to
set a value to the document variable and then use Print Preview, I get the
opposite behaviour, the fields in the Header are updated, but those in the
body of the document are not (regardless of the setting of the Update fields
item under Tools>Options>Print). To get the fields in the body to update,
it was necessary to select them and then press F9.

However, whenever I work with document variables and docvariable fields
(which is in virtually all of my templates), I include a routine to update
the fields where ever they appear so that the user immediately sees the
result.

For your document, I used the following and with that, everything is
displayed correctly.

Dim i As Long
With ActiveDocument
.Variables("Data").Value = "25/12/2005"
For i = 1 To .Sections.Count
.Sections(i).Headers(wdHeaderFooterFirstPage).Range.Fields.Update
.Sections(i).Headers(wdHeaderFooterPrimary).Range.Fields.Update
.Sections(i).Footers(wdHeaderFooterFirstPage).Range.Fields.Update
.Sections(i).Footers(wdHeaderFooterPrimary).Range.Fields.Update
Next i
.Range.Fields.Update
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top