Word Tips and Hints: Placing Current File Name In The Footer
Want put the file name at the bottom of your document in the lower-left corner, the way it appears in solicitors’ documents?
You can write a macro to insert the text. To write the macro, run Word and press F11 to open the VBA editor. If you don’t currently have any modules, click Normal and choose Insert, Module.
Now, add the following code:
Sub InsertInFooter()
Dim ThisFile As String
ActiveWindow.ActivePane.View.Type = wdPageView
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
End If
ThisFile = ActiveDocument.Name
Selection.TypeText ThisFile
ActiveWindow.ActivePane.View.SeekView =
wdSeekMainDocument
ActiveWindow.View.Type = wdNormalView
End Sub
Press Ctrl-S to save your new macro and then press Alt-Q to return to your Word document.
Next, let’s assign a toolbar button to the new macro. To do this, choose View, Toolbars, Customize. When the Customise dialog box opens, click the Commands tab. Under Categories, click Macro. Now, locate your new macro in the Customize right pane and use the mouse to drag it to the Word toolbar. When you release the mouse button, click Modify Selection and enter the name you’d like to use for the button. Click Close to dismiss the dialog box and save your new selection.
All you’ll need to do now is click the button in a document and the macro will insert the file name into the left side of the footer. The file name will appear on all pages in the document – don’t click the button for each page.
Note: This macro sets you to Normal view before it closes. If you normally work in Page Layout view, you can delete the line. ActiveWindow.View.Type = wdNormalView and you’ll remain in Page Layout view. You use ActiveWindow.View. Type = wdOnlineView for Online view or ActiveWindow. ActivePane.View.Type = wdOutlineView for Outline view.
Tags: Feb/Mar 09



