Update docvariable fields in Header

R

Richard

How do you update docvariable fields in the Headers?

I tried ActiveDocument.Fields.Update but that updates fields in the document
body and not the headers.

Regards,
Richard
 
D

Doug Robbins - Word MVP

You can use

With ActiveDocument
.PrintPreview
.ClosePrintPreview
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
 
D

Doug Robbins - Word MVP

Yes, it involved iterating through each of the Story Ranges in the document
and updating the fields in each. That procedure is used in the
article "Using a macro to replace text where ever it appears in a document
including Headers, Footers, Textboxes, etc." at:

http://www.word.mvps.org/FAQs/MacrosVBA/FindReplaceAllWithVBA.htm


--
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
 
Q

qumranandy

Dear Doug,
I'm doing a concordance/dictionary of Greek words in the Bible, 1-2 Samuel.
The diocument is a 3-column table with the the Greek words listed in the left
column. In the right columns there is often more than one cell of
explanation. There can be up to 10 cells of explanation, and in that case I
don't want the Greek word to repeat in the left column. I want the cells in
the left column to be blank. Problem is, Word doesn't do the headers
correctly. If a page begins with blank cells at the left, I want the header,
which is formatted "From (field 1) to (field 2)" done with Stye-Refs, to give
me after "From" the information from the last nonemprty cell in the prrevious
page, not the first nonempty cell in the current page. I've been over and
over this with Suzanne Barnhill in the Word group, and in exasperation she
referred me to you. Can I do this with a macro? I've never programmed with
Word, though I used to write all my own software in Basic.
 
D

Doug Robbins - Word MVP

I think that the best thing for you to do is to repeat the Greek Word on
each page, but format it so that the font is white so that it cannot be
seen. Then you can use a Styleref field to have it display in the header.

--
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
 
Q

qumranandy

Which do I sthyle-ref white and which black? And which do I put as field in
the header?
 
D

Doug Robbins - Word MVP

I understood that on the first page of entry for the Greek word that appears
in Column 1, you want it to appear in the header and for that you are using
a StyleRef field and that if that entry continues for more than one page,
you want the word to appear in the header of the subsequent page without it
having to appear in column one again. The method I suggested would require
you to insert the word in Column 1 again, but format the font so that it was
white and could not be seen. Nothing needs to be done with the StyleRef
field.

--
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
 
Q

qumranandy

Dear Doug,
Good idea for the finished document. But what is a finished document? I'm
doing an employee -list of Microsoft. It's a two-column table with
employee-name at the left and a positon summary at the right. It's going
great I've got
Joe Atkins Maintenance
Suzanne Barnhill Customer relations
etc.
etc.
Joe Benson security
every line filled on the first page, and the header reads "From Joe Atkins
to Joe Benson". But then on page five I get to "Bill Gates", and I need one
lline for "president", one line for "monopolist", one line for "Harvard
dropout", and it goes on and on for three pages. What's going to be in the
header for the Gates middle page? "From _ to _", because there's nothing in
the left column. Not only should Word get "Bill Gates" into the two fields
in the header, but it should also insert "Bill Gates" in the first empty cell
at the top left. As a courtesy to the reader. Your solution works with the
finished document, but what if I want to add something - like
"philanthropist" - to the lines for Bill Gates? Then I've got to reformat
what's at the left - change one cell to white the other to black. But thanks
for the idea. I just tried it, and it does work - whiting out the words
doesn't change the Style-Ref in the eyes of the Header mechanism.
 

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