|
|
|
|
|
|
Word
|
Fill first page footer
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000, 2002
|
Submitted by:
|
MOS MASTER
|
Description:
|
Fill the first page footer only with autotext entries. One will insert the filename and path (if the documents is saved or else only the temporary filename) and one will insert the last person who saved the document.
|
Discussion:
|
It's usually a good idea to insert the filename and path in your document to keep track of it. The same applies to the last person who saved a document. This sub only works if the section (1) has the folowing setting: Menu | File | Page setup | Layout | Different First Page. (to fill the first page footer)
|
Code:
|
instructions for use
|
Option Explicit
Sub PathInFooter()
Dim oRange As Word.Range
Set oRange = ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range
With NormalTemplate
.AutoTextEntries("Filename and path").Insert Where:=oRange, RichText:=True
With oRange
.InsertAfter Text:=vbCr
.Collapse Direction:=wdCollapseEnd
End With
.AutoTextEntries("Last saved by").Insert Where:=oRange, RichText:=True
End With
Set oRange = Nothing
End Sub
|
How to use:
|
- Open your Word document.
- Press Alt + F11 to open VBE.
- Insert-Module. (Insert -> module)
- Paste the code there in the window at right. (F7)
- Close VBE (Alt + Q or press the X in the top right hand corner).
- Save the file.
|
Test the code:
|
- If you have your page setup for "Different first page" (File | Page setup | Layout | Different First Page) you can run the below sub to get that data in to the first page footer.
- Use Tools | Macro | Macro's and doubleclick: "PathInFooter"
|
Sample File:
|
Fill firstpage footer.zip 7.42KB
|
Approved by mdmackillop
|
This entry has been viewed 96 times.
|
|