Where would that code go? I have little/no experience in VB coding.
Thank you.
The code goes in place of all that rubbish you currently have in the
Auto_Open sub. Your code is currently trying to update fields in the
document including in headers and footers. The key problem is that it's
making assumptions about the structure of your document (ie what headers and
footers are defined), and the error message is just demonstrating the
invalidity of those assumptions. On top of which, it is seriously lousy
code.
Doug's method will normally work, because switching to PrintPreview mode
normally updates all fields anyway. However it will fail if you have no
printer installed (unlikely); and it can be ugly if the active printer is
Acrobat and the document is unsaved.
A fail-safe method is this code --
Dim pRange As Word.Range
For Each pRange In ActiveDocument.StoryRanges
Do
pRange.Fields.Update
Set pRange = pRange.NextStoryRange
Loop Until pRange Is Nothing
Next
This is independent of your printer, it works even if Word is not visible,
and it doesn't muck around with the user interface.
> Where would that code go? I have little/no experience in VB coding.
>
[quoted text clipped - 112 lines]
>> >
>> > Any help would be greatly appreciated.
Doug Robbins - Word MVP - 15 Nov 2005 05:27 GMT
That code (using prange) may need to be extended using the syntax in the
article "Using a macro to replace text where ever it appears in a document
including Headers, Footers, Textboxes, etc.":
http://www.word.mvps.org/FAQs/MacrosVBA/FindReplaceAllWithVBA.htm

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> The code goes in place of all that rubbish you currently have in the
> Auto_Open sub. Your code is currently trying to update fields in the
[quoted text clipped - 142 lines]
>>> >
>>> > Any help would be greatly appreciated.
Jezebel - 15 Nov 2005 06:15 GMT
That code uses precisely the method described in the MVP article; just more
succintly.
> That code (using prange) may need to be extended using the syntax in the
> article "Using a macro to replace text where ever it appears in a document
[quoted text clipped - 151 lines]
>>>> >
>>>> > Any help would be greatly appreciated.
Doug Robbins - Word MVP - 15 Nov 2005 20:34 GMT
Or so subtly that I overlooked it <g>

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> That code uses precisely the method described in the MVP article; just
> more succintly.
[quoted text clipped - 156 lines]
>>>>> >
>>>>> > Any help would be greatly appreciated.
Me - 15 Nov 2005 18:37 GMT
I will try this.
Thank you very much. :-)
> The code goes in place of all that rubbish you currently have in the
> Auto_Open sub. Your code is currently trying to update fields in the
[quoted text clipped - 138 lines]
> >> >
> >> > Any help would be greatly appreciated.