Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
EPA EPA is offline
external usenet poster
 
Posts: 10
Default Updating Document Properties in lots of headers and footers

(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.
--
Ted
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Updating Document Properties in lots of headers and footers

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.

--

Graham Mayor - Word MVP

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


EPA wrote:
(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.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Updating Document Properties in lots of headers and footers

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
"EPA" wrote in message
...
(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.
--
Ted


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
EPA EPA is offline
external usenet poster
 
Posts: 10
Default Updating Document Properties in lots of headers and footers

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?
--
Ted


"Peter Jamieson" wrote:

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
"EPA" wrote in message
...
(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.
--
Ted



  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Updating Document Properties in lots of headers and footers

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

"EPA" wrote in message
...
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?
--
Ted


"Peter Jamieson" wrote:

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
"EPA" wrote in message
...
(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.
--
Ted






  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
EPA EPA is offline
external usenet poster
 
Posts: 10
Default Updating Document Properties in lots of headers and footers

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

--
Ted


"Peter Jamieson" wrote:

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

"EPA" wrote in message
...
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?
--
Ted


"Peter Jamieson" wrote:

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
"EPA" wrote in message
...
(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.
--
Ted




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open new document with headers and footers as before. Easily_A_Noid Microsoft Word Help 6 August 21st 06 11:15 PM
footers not updating in merged/saved document Mona Webb Page Layout 2 August 10th 06 10:28 AM
keyboard shortcut in Word 2003 for updating ALL fields including headers and footers Adrian New Users 2 May 3rd 06 08:49 AM
My document won't print right with headers and footers? Solo Microsoft Word Help 1 February 7th 06 07:34 PM
insert document with headers and footers Robb Microsoft Word Help 1 January 5th 05 10:17 PM


All times are GMT +1. The time now is 01:30 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"