I have an excel VBA project and as part of that I launch a word doc and fill in information that was input on a userform in the excel doc(to prevent double-entry of data). The word doc has to be protected so that users can't alter the info.
I have the word doc protected to start with. Then at the start of that section of VBA code, I unprotect the document.
wdDoc.Unprotect Password:="XXXXXXXX"
Then once I populate all the info with my code, I need to re-protect the word doc from any changes.
I recorded a macro to get the code.
wdDoc.Protect Password:="XXXXXXXX", NoReset:=False, Type:= _
wdAllowOnlyFormFields, UseIRM:=False, EnforceStyleLock:=False
It all works up until the re-protecting of the document. The document isn't protected. I can make changes. I don't get any error messages though.
I have tried different options on the Type argument. I have also tried setting the EnforceStyleLock argument = True instead of False.
Nothing seems to work. Any suggestions?
Thanks for any help you can provide.
I have the word doc protected to start with. Then at the start of that section of VBA code, I unprotect the document.
wdDoc.Unprotect Password:="XXXXXXXX"
Then once I populate all the info with my code, I need to re-protect the word doc from any changes.
I recorded a macro to get the code.
wdDoc.Protect Password:="XXXXXXXX", NoReset:=False, Type:= _
wdAllowOnlyFormFields, UseIRM:=False, EnforceStyleLock:=False
It all works up until the re-protecting of the document. The document isn't protected. I can make changes. I don't get any error messages though.
I have tried different options on the Type argument. I have also tried setting the EnforceStyleLock argument = True instead of False.
Nothing seems to work. Any suggestions?
Thanks for any help you can provide.