View Single Post
  #10   Report Post  
Graham Mayor
 
Posts: n/a
Default

I suppose you could always intercept the Save and SaveAs commands *in the
particular document template* to add the code to update the field. I have
used the simple switch to print preview and back method here which works for
this particular task and I have added a line to put the filename in the
document window caption.

You need to add a conditional field in the header/footer to put the filename
on the last page only. No section breaks needed.

i.e. {IF {Page} = {Numpages} "{FILENAME \p }"}


Sub FileSaveAs()
Dialogs(wdDialogFileSaveAs).Show
Options.UpdateFieldsAtPrint = True
Application.ScreenUpdating = False
PrintPreview = True
PrintPreview = False
ActiveDocument.ActiveWindow.View.Type = wdPrintView
Application.ScreenUpdating = True
ActiveWindow.Caption = ActiveDocument.FullName
End Sub
Sub FileSave()
Options.UpdateFieldsAtPrint = True
Application.ScreenUpdating = False
PrintPreview = True
PrintPreview = False
ActiveDocument.ActiveWindow.View.Type = wdPrintView
Application.ScreenUpdating = True
ActiveDocument.Save
ActiveWindow.Caption = ActiveDocument.FullName
End Sub

Should do the trick http://www.gmayor.com/installing_macro.htm

--

Graham Mayor - Word MVP

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





Nikkit72 wrote:
Thanks for your reply, unfortunately what Teeder suggested is what we
do at the moment but human error takes over and some people dont
update the fields which causes all kinds of problems. We used to use
Wordperfect which auto updated the path and filename and I think that
some people still forget that Word doesnt auto update unless its a
field code.

Nikki

"Suzanne S. Barnhill" wrote:

It is rarely convenient to have a section break interrupting the
continuous text flow between pages.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

"Teeder" wrote in message
...
I don't understand why you wouldn't just insert a NEXT PAGE section
break on the second last page, and then insert a FILENAME with PATH
field in footer of the second section of the document (being sure
to remove the SAME AS PREVIOUS) button. Then if you want the field
to update without closing out of the document you could go to the
FOOTER and right click on the field and ask it to UPDATE FIELD.

"Nikkit72" wrote:

On a document I know if you put the filename in as a field code in
the footer it will auto update on saving or printing.

How do I put in a field code on just one page (ie the last page of
a document) and still get the filename to auto update?

Thanks in advance