how to create a custom footer macro

M

Mindy

I try to record a macro of setting up a page footer (show the file name and
path), however, when i start recording the focus always on the header section
instead of the footer. Is there anyway to create a custom footer macro
instead of a header macro.

Please help.
Thanks
 
S

Steve Franks

I presume that you're talking about Word.
This is a modified version of the code produced when you record your actions:

Sub CustomFooter()
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter

Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Selection.TypeText Text:=" of "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
Selection.TypeText Text:=vbTab
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME ", PreserveFormatting:=True
End Sub

It places page x of y in the footer, followed by a tab then a field
containing the filename.
I hope it helps,
Steve
 

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