Filename Font Size

D

DPete14

I have created a template (M$ Word 2007), and have inserted a field in the
footer to have the filename with path. I have set options to update fields
before printing. When a new document is created using this template, the
document is saved to give it a real file name, and then the document is
printed, the filename field changes font size to 11pt, which is the "Normal"
size, even though when I set up the filename field I told it to be 8pt. How
can I get the field to update and stay the same size?
 
G

Graham Mayor

The following macro will update only the filename field when you save the
document. Copy the macro and save it with the name FileSaveAs to ensure it
updates if you change the filename:

Sub FileSave()
Dim oField As Field
Dim oSection As Section
Dim oFooter As HeaderFooter
ActiveDocument.Save
For Each oSection In ActiveDocument.Sections
For Each oFooter In oSection.Footers
If oFooter.Exists Then
For Each oField In oFooter.Range.Fields
If oField.Type = wdFieldFileName Then
oField.Update
End If
Next oField
End If
Next oFooter
Next oSection
End Sub

http://www.gmayor.com/installing_macro.htm

The font size issue can be overcome by opening the footer and toggling the
field display with ALT+F9 to show
{Filename \p} add a charformat switch within the brackets thus

{Filename \p \*Charformat} then update the field (F9) and if necessary
toggle the display again to show the result. See
http://www.gmayor.com/formatting_word_fields.htm

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

DPete14

Thanks Graham. I didn't need the macro, just adding the "\*Charformat"
switch in the field did the trick. Worked like a charm.

Dan
 

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