I have a macro that replaced the header and footer of all documents in a directory with the one in the document that I run the macro from. I have a field in the footer that shows the document name - this updates with every document however shows the .doc extension. Is there anyway to remove this extension from every field with FileName in please?
Thanks.
Code updating the footer and the field:
For Each HdFt In .Sections.First.Footers
If HdFt.Exists Then
If wdDocSrc.Sections.First.Footers(HdFt.Index).Exists Then
HdFt.Range.FormattedText = wdDocSrc.Sections.First.Footers(HdFt.Index).Range.FormattedText
End If
End If
Next
'NEW
For Each aStory In wdDocTgt.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Next aStory
'HERE
.Close SaveChanges:=True
End With
Bookmarks