The below code works when the document is open and saved from the toolbar; however, it does not work when the document is closing and saved from the pop-up prompt. The code is called by the DocumentBeforeSave event.
OldFile = ActiveDocument.Path & "\" & ActiveDocument.Name
If OldFile <> strTmpName & ".docx" Then
I receive Run time error 70 (permission denied) for the 'Kill OldFile' command.
I am using this code to extract information from the document which is reflected in the documents name, so the name of the document is never static. Any direction would be greatly appreciated!