Re: Update footer Fields

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Did you try the second option?

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

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



John wrote:
> Thanks for that. Unfortunately, PrintPreview doesn't update this
> particular field. If I use PrintPreview from the File menu it stays
> the same. It's only when I actually Print the document that it
> updates. Unfortunately, these documents are normally emailed and
> therefor seldom printed.
>
> John
>
> "Graham Mayor" <gmayor@xxxxxxxxxxxxxxxxxx> wrote in message
> news:u0FT2abYFHA.2664@xxxxxxxxxxxxxxxxxxxxxxx
>> Assuming the second part is actually a field and not merely typed
>> from the keyboard then try
>>
>> Options.UpdateFieldsAtPrint = True
>> Application.ScreenUpdating = False
>> PrintPreview = True
>> PrintPreview = False
>> ActiveDocument.ActiveWindow.View.Type = wdPrintView
>> Application.ScreenUpdating = True
>>
>> or
>>
>> Dim oField As Field
>> Dim oSection As Section
>> Dim oHeader As HeaderFooter
>> Dim oFooter As HeaderFooter
>>
>> For Each oSection In ActiveDocument.Sections
>> For Each oHeader In oSection.Headers
>> If oHeader.Exists Then
>> For Each oField In oHeader.Range.Fields
>> oField.Update
>> Next oField
>> End If
>> Next oHeader
>> For Each oFooter In oSection.Footers
>> If oFooter.Exists Then
>> For Each oField In oFooter.Range.Fields
>> oField.Update
>> Next oField
>> End If
>> Next oFooter
>> Next oSection
>>
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> John wrote:
>>> Hi,
>>>
>>> I have the following Field in the footer of a template. It updates
>>> fine when printed but I am trying to get it to update when I do a
>>> FileSaveAs.
>>>
>>> {FILENAME \* Lower \* MERGEFORMAT }{if{numpages}>{page}" /more"}
>>>
>>> I have included some code to update these fields and the FILENAME
>>> updates OK, but the second part doesn't.
>>>
>>> Sub FileSaveAs()
>>> For Each pRange In ActiveDocument.StoryRanges
>>> Do
>>> For Each oFld In pRange.Fields
>>> oFld.Update
>>> Next oFld
>>> Set pRange = pRange.NextStoryRange
>>> Loop Until pRange Is Nothing
>>> Next
>>> End Sub
>>>
>>> Any suggestions what I can do to make the second part update?
>>>
>>> Thanks,
>>>
>>> John


.



Relevant Pages