Field Codes in Word

D

dennyone

I modified my "Normal" template to use "Filename" field in footer. When I
save a document created using "New Blank Document," the "Filename" field will
not update. When I click in the grayed area of the "Filename" and press
Alt+F9, I get the field codes (as if I've checked Field Codes in the View
folder of Options) and when I press Alt+F9 again, the field is not updated to
the new document name, but still says "Normal". I've clicked in the grayed
area and pressed Ctrl+Shift+11 to unlock the field with no results either.
 
C

CyberTaz

Alt+F9 simply toggles the display of the Field Codes, it doesn't update
Fields. Clck in the Field & press just F9 or right-click the field & choose
Update Field from the shortcut menu.

Does that make any difference?
 
G

Graham Mayor

There are a couple of issues here. If you put the filename field in
normal.dot (which is a bad idea as it will have knock-on effects eg when
creating labels) then it will correctly show the name of the template, which
if you are not displaying filename extensions in Windows will be Normal! No
amount of updating will change that.

New documents created from the template will not have a name until they are
saved and so the field should show Documentn where n is the current new
document number.

Alt+F9 does not update the field, but toggles the display to show the field
construction. F9 updates the field (when selected) or you could use a macro
to force an update eg the sample code at
http://www.gmayor.com/installing_macro.htm

You might be better using a macro to place the filename at the end of the
document eg

Sub InsertFilenameFooter()
Dim sFileName As String
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
sFileName = .FullName
End With
Selection.EndKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
With Selection
.ParagraphFormat.Alignment = wdAlignParagraphRight
.TypeText Text:=sFileName
.EndKey Unit:=wdStory
End With
With ActiveWindow.ActivePane.View
.SeekView = wdSeekMainDocument
End With
End Sub

Change the line
sFileName = .FullName
to
sFileName = .Name
if you don't want the path included.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top