Automatic Footers in Word using VBA Macros

warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'zen_menu_item_link' not found or invalid function name in /hermes/bosnaweb22a/b2525/ipw.jfalkofske/public_html/maindrup/includes/theme.inc on line 669.

I'm in a new office environment in which I'm generating lots of data reports.  One of the things I have found frustrating in other environments is being handed a printed copy of a report and having no idea where the original electronic version is stored. 

This VBA macro can be used to set up a standard footer in your Word documents which includes the full path and filename for the report as well as the current page out of total pages.


Now each time I create a report, I have a simple macro to run which creates a standard footer which shows others where to find the electronic version of my printed reports.

Here is the code
Sub InsertFooter()
' InsertFooter Macro
' Insert a File Footer with filename and page numbers

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
'Set the footer
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.Font.Size = 9
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="FILENAME \p ", PreserveFormatting:=True
Selection.TypeText Text:=vbTab
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="PAGE ", PreserveFormatting:=True
Selection.TypeText Text:=" of "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="NUMPAGES ", PreserveFormatting:=True
End Sub

James Falkofske - TechnologyBites.blogspot.com