Mornin',
I've got a template in Word 2007 that I'm creating that several people will be using and, to avoid issues from people accidentally changing or deleting stuff in the document, I'm restricting editting to form fields only and password protecting it. What I want to happen is for the macro to run, unprotect the document, save it as a separate, macro-free file and then protect the document WITHOUT the password in order to prevent people from accidentally making changes, but allowing them to make intentional edits in case they need to reformat, clean up data, etc.
So my template starts out as protected and here's the code that I'm using:
The problem I'm running into is that, when I close the document and open the "OtherFile.doc" that was saved, it still has "Password" as the password. I've tried it without defining a password before it's saved at all as well as not using a variable and just an emplty string, so
at the end, but it all results in the same - which I expected but thought it worth a shot.
Any suggestions on how to remedy this?
Best Regards,
RCT
I've got a template in Word 2007 that I'm creating that several people will be using and, to avoid issues from people accidentally changing or deleting stuff in the document, I'm restricting editting to form fields only and password protecting it. What I want to happen is for the macro to run, unprotect the document, save it as a separate, macro-free file and then protect the document WITHOUT the password in order to prevent people from accidentally making changes, but allowing them to make intentional edits in case they need to reformat, clean up data, etc.
So my template starts out as protected and here's the code that I'm using:
Code:
Pwd="Password"
ActiveDocument.Unprotect Password:=Pwd
'...
'rest of code here
'...
Pwd = ""
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=Pwd
ActiveDocument.SaveAs "OtherFile.doc"
The problem I'm running into is that, when I close the document and open the "OtherFile.doc" that was saved, it still has "Password" as the password. I've tried it without defining a password before it's saved at all as well as not using a variable and just an emplty string, so
Code:
Password:=""
Any suggestions on how to remedy this?
Best Regards,
RCT