Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Open new document with headers and footers as before. | Microsoft Word Help | |||
footers not updating in merged/saved document | Page Layout | |||
keyboard shortcut in Word 2003 for updating ALL fields including headers and footers | New Users | |||
My document won't print right with headers and footers? | Microsoft Word Help | |||
insert document with headers and footers | Microsoft Word Help |