I have a word template that is protected, trying to set the footer so that it updates to the file name when opening and closing the document. I can't seem to figure out the correct macro or vb for it.
The closest I've gotten is this:
' If document is protected, unprotect it.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = ActiveDocument.FullName
End If
However, it does not update the footer with the file name at opening or closing the docx.
The closest I've gotten is this:
' If document is protected, unprotect it.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = ActiveDocument.FullName
End If
However, it does not update the footer with the file name at opening or closing the docx.