Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2007

Tip: Looking for answers? Try searching our database.

updating fields in multiple footers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Helen - 09 Aug 2007 20:56 GMT
Hi everyone,

I have a template setup including a userform, and a couple of different
sections with Ref fields in the footers. I want my code on the OK button in
the userform to cycle through all the footers in the document and update the
fields.

ActiveDocument.Fields.Update seems to completely ignore the headers/footers.
I've tried recording a macro that goes to the footer, selects all and
updates the fields. I put that code into a For Each headerfooter in
headerfooters...next loop, without success. Likewise everything else I've
tried works only for the first section then bombs out.

Can anyone point me in the right direction please?

Thanks in advance,

Helen
Helen - 09 Aug 2007 21:09 GMT
Hi again, I've just spotted the post from jerem below on "Deleting a
specific field code in footers" and used his loop - it works beautifully for
my purposes!! Thanks jerem :-)
cheers, Helen

> Hi everyone,
>
[quoted text clipped - 15 lines]
>
> Helen
Russ - 12 Aug 2007 18:55 GMT
Helen,

This code should update all fields:
Sub UpdateAllFields()
Dim oStory As Range
 For Each oStory In ActiveDocument.StoryRanges
   oStory.Fields.Update
   If oStory.StoryType <> wdMainTextStory Then
     While Not (oStory.NextStoryRange Is Nothing)
       Set oStory = oStory.NextStoryRange
       oStory.Fields.Update
     Wend
   End If
 Next oStory
 Set oStory = Nothing
End Sub

As to your code, if it did work for the first section, then you should be
able to encapsulate it with:
Dim aSection as Word.Section
For each aSection in ActiveDocument.Sections
***Your code here
Next aSection

> Hi everyone,
>
[quoted text clipped - 14 lines]
>
> Helen

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.