Update Field in table in header

P

Poody

I'm trying to update some fields located in table cells in the header, and am
not having any success.

These fields are the same fields located on the first page of the document
(in other words, they have the same name and should have the same values).
The macro I have updates the fields on page 1, but does not update them in
the header.

Here's the code from my macro (not including everything - just the relevant
portion):

<begin code>
Dim aStory As Range
Dim aField As Field

For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Set aStory = aStory.NextStoryRange
Next aStory
<end code>

Don't know if it is important or not, but the header information is not on
the first page header, but is included on all subsequent page headers.

Thanks,

Rich
 
J

Jay Freedman

I'm not sure this will help, but it sounds like you might have the "empty
header" problem mentioned in step 2 of
http://word.mvps.org/faqs/customization/ReplaceAnywhere.htm. Try adding the
declaration and assignment of lngJunk as shown in that code.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
P

Poody

Thanks for the idea - unfortunately, it didn't help. I added the information
and nothing. However, in the course of investigating why it wasn't working -
I discovered (by adding a watch in the macro) that the macro doesn't seem to
see the table contained in the header. It finds stuff in the header (for
example, the first row of data - or at least the values in those cells), but
doesn't seem to recognize it as a table. At least that is my assumption, I
clicked on the plus sign in the Expression column (when the Value column
shows the value of the first row of the table in the Header), and Rows shows:
"<There is no table at this location>"... ?

Rich
 
J

Jay Freedman

I don't know what to tell you at this point, but if you can zip and email the
document to me, I'll have a look.

Jay
 

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