A
AngeloUCF
I'm trying to write a macro that I can link to a custom toolbar/button
that will add the file name and path of a document to the footer and
remove it if it has been added. It was pretty easy in excel but word
seems much more difficult for some reason. Here's one version that I
tried that doesn't work.
Function WordFilePath()
' WordFilePath Macro
Const wdFieldFileName = 29
If ActiveDocument.Sections(1).Footers(1).Show = True Then
Set objrange = ActiveDocument.Sections(1).Footers(1).Range
Set objField = objdoc.Fields.Add(objrange, wdFieldFileName)
Else
Set objrange = ActiveDocument.Sections(1).Footers(1).Range
Set objField = objdoc
End If
End Function
that will add the file name and path of a document to the footer and
remove it if it has been added. It was pretty easy in excel but word
seems much more difficult for some reason. Here's one version that I
tried that doesn't work.
Function WordFilePath()
' WordFilePath Macro
Const wdFieldFileName = 29
If ActiveDocument.Sections(1).Footers(1).Show = True Then
Set objrange = ActiveDocument.Sections(1).Footers(1).Range
Set objField = objdoc.Fields.Add(objrange, wdFieldFileName)
Else
Set objrange = ActiveDocument.Sections(1).Footers(1).Range
Set objField = objdoc
End If
End Function