Janine
08-31-2007, 01:30 AM
I get an error on "Insert last.... Autotext " How do I make it work for 2007 Building Blocks as well please?:cloud9: Option Explicit
Sub PathInFooter()
Dim oRange As Word.Range
'Get a handle to the firstpage Footer
Set oRange = ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range
'Get autotext from Normal.dot
With NormalTemplate
'Insert Filename and path in footer
.AutoTextEntries("Filename and path").Insert Where:=oRange, RichText:=True
With oRange
'Insert paragraph mark after the filename
.InsertAfter Text:=vbCr
'Collapse to the end of the range
.Collapse Direction:=wdCollapseEnd
End With
'Insert Last saved by {Name} in footer
.AutoTextEntries("Last saved by").Insert Where:=oRange, RichText:=True
End With
'Clean up
Set oRange = Nothing
End Sub
Sub PathInFooter()
Dim oRange As Word.Range
'Get a handle to the firstpage Footer
Set oRange = ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range
'Get autotext from Normal.dot
With NormalTemplate
'Insert Filename and path in footer
.AutoTextEntries("Filename and path").Insert Where:=oRange, RichText:=True
With oRange
'Insert paragraph mark after the filename
.InsertAfter Text:=vbCr
'Collapse to the end of the range
.Collapse Direction:=wdCollapseEnd
End With
'Insert Last saved by {Name} in footer
.AutoTextEntries("Last saved by").Insert Where:=oRange, RichText:=True
End With
'Clean up
Set oRange = Nothing
End Sub