Have File Name Field Code Font Size 8

J

jerem

Scavenged some code and changed it a bit, however, need to have the FileName
come into the footer as a Font Size of 8 pt. Thanks in advance for your help.


Sub NumberPages2()
'
' PageNumbersEveryPage Macro
'

Dim oRng As Range
Dim oSection As Section
Dim oFooter As HeaderFooter

Call SameAsPrevious
For Each oSection In ActiveDocument.Sections
For Each oFooter In oSection.Footers
If oFooter.Exists Then
Set oRng = oFooter.Range
With oRng
.Fields.Add oRng, wdFieldPage, , False
.InsertBefore "-"
.InsertAfter "-"
.Collapse wdCollapseEnd
.ParagraphFormat.Alignment = _
wdAlignParagraphCenter
.Fields.Add oRng, wdFieldFileName
.InsertAfter Chr(13)
.Collapse wdCollapseEnd
.ParagraphFormat.Alignment = _
wdAlignParagraphLeft

End With
End If
Next oFooter
Next oSection

End Sub
 
G

Graham Mayor

Something like:

Sub NumberPages2()
'
' PageNumbersEveryPage Macro
'

Dim oRng As Range
Dim oSection As Section
Dim oFooter As HeaderFooter

'Call SameAsPrevious
ActiveDocument.Save
For Each oSection In ActiveDocument.Sections
For Each oFooter In oSection.Footers
If oFooter.Exists Then
Set oRng = oFooter.Range
With oRng
.Fields.Add oRng, wdFieldPage, , False
.InsertBefore "-"
.InsertAfter "-"
.Collapse wdCollapseEnd
.ParagraphFormat.Alignment = _
wdAlignParagraphCenter
.Fields.Add oRng, wdFieldFileName, , False
.InsertAfter Chr(13)
.Collapse wdCollapseEnd
With oFooter.Range
With .Paragraphs(2).Range
.ParagraphFormat.Alignment = _
wdAlignParagraphLeft
.Font.Size = 8
End With
.Fields.Update
End With
End With
End If
Next oFooter
Next oSection
ActiveWindow.View.ShowFieldCodes = False
End Sub



--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
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