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 / Mailmerge and Fax / July 2007

Tip: Looking for answers? Try searching our database.

Updating Document Properties in lots of headers and footers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
EPA - 28 Jun 2007 12:06 GMT
(Word 2003 on Windows XP)  If you have many sections, all with different
first page, different odd and even, you can have three headers and three
footers to update for each section whenever you change a document property
(e.g. security classification) that is referenced in all of the footers (no,
I don't want it like that, but someone else "in authority" does).  Is there
an easy way to update all of these, without actually printing the document?  
I'd like it to be automatic: I've seen plenty of cases where people have
forgotten to update both the odd and the even footer, even when there's only
one section in a document.  I've seen the exchange between Nuzza and Lene in
Feb/Mar this year, but I don't know enough about VBA to determine whether the
UpdateAll code does what I want.
Signature

Ted

Graham Mayor - 28 Jun 2007 15:38 GMT
Without digging back through the archives, I don't know which code you are
referring to, but the sample macro at
http://www.gmayor.com/installing_macro.htm should update the document
including all the headers and footers.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> (Word 2003 on Windows XP)  If you have many sections, all with
> different first page, different odd and even, you can have three
[quoted text clipped - 8 lines]
> Lene in Feb/Mar this year, but I don't know enough about VBA to
> determine whether the UpdateAll code does what I want.
Peter Jamieson - 28 Jun 2007 17:55 GMT
It should. In the past I've never been sure about fields in shapes within
headers and footers etc. but another experiment suggests it's OK after all.
You can "simplify" the code of UpdateAll marginally to

Sub UpdateAllFields()
Dim objRange As Word.Range
For Each objRange In ActiveDocument.StoryRanges
 Do
   objRange.Fields.Update
   Set objRange = objRange.NextStoryRange
 Loop Until objRange Is Nothing
Next
End Sub

Peter Jamieson
> (Word 2003 on Windows XP)  If you have many sections, all with different
> first page, different odd and even, you can have three headers and three
[quoted text clipped - 13 lines]
> the
> UpdateAll code does what I want.
EPA - 02 Jul 2007 09:10 GMT
Thank you, Graham and Peter.  Now, I've got a macro that does the job
whenever the file is closed.  How do I stop it running when the file has been
opened as read only, or when no changes have been made to the file?
Signature

Ted

> It should. In the past I've never been sure about fields in shapes within
> headers and footers etc. but another experiment suggests it's OK after all.
[quoted text clipped - 28 lines]
> > the
> > UpdateAll code does what I want.
Peter Jamieson - 02 Jul 2007 09:27 GMT
You can check ActiveDocument.ReadOnly and ActiveDocument.Saved (which is
True if the document is completely unchanged). SInce the user can in fact
change a read only document "in memory" you may need to do different things
depending on what values these properties have.

Peter Jamieson

> Thank you, Graham and Peter.  Now, I've got a macro that does the job
> whenever the file is closed.  How do I stop it running when the file has
[quoted text clipped - 40 lines]
>> > the
>> > UpdateAll code does what I want.
EPA - 03 Jul 2007 12:02 GMT
This is dangerous - I'm starting to enjoy it!

I've ended up with
If (Not Readonly) or (Readonly and (not Saved)) then Updateall

I noticed that this didn't update any TOCs, so I found this fragment from
Jay Freedman, which I'm going to incorporate as well.
I've also sent a request to mswish (oh dear ...)

Quote:------
Bearing in mind that any document may have zero, one, two, or more tables of
contents, the following code will handle any of those situations:

   Dim TOC As TableOfContents

   For Each TOC In ActiveDocument.TablesOfContents
       TOC.Update
   Next

If your macro assigns the document in question to a variable of type
Document, then replace "ActiveDocument" with the name of that variable.

If your document also contains tables of authorities and/or tables of
figures created with fields of those types, then you'll need separate loops
to handle the members of the TablesOfAuthorities and TablesOfFigures
collections.
EndQuote:------

Signature

Ted

> You can check ActiveDocument.ReadOnly and ActiveDocument.Saved (which is
> True if the document is completely unchanged). SInce the user can in fact
[quoted text clipped - 47 lines]
> >> > the
> >> > UpdateAll code does what I want.

Rate this thread:






 
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.