General information
Category:
COM/DCOM and OLE Automation
There is a setting for the VB Project Protection. If you go to VB editor (Alt+F11)-> Tools->Project Properties->Protection, then you can set (manually) the desired Lock state and the password.
I was not able to find how to set the project protection properties programmatically, as I see them read only,
?oWord.APPLICATION.VBE.VBProjects("Project").protection
However as a temporarty solution you can use a sendkeys() that works for me for Word97, like:
*---------------------------
LOCAL oWord
oword=GETOBJECT(,"Word.Application")
oWord.WindowState=0
oWord.APPLICATION.activate
* invoke VB Editor, project protection dialog, set lock on, set password YY, confirm password YY, close dialog, close VB Editor
oWord.Wordbasic.Sendkeys("%{F11}%Te+{TAB}{RIGHT}{TAB}={TAB}YY{TAB}YY{ENTER}%FC")
oWord=.null.
*----------------
The key string may vary for different Word Versions.
Please, let me know if you find the way to set project protection programmatically.
Thanks
>Dear all;
>
>After the usual: oword=createobject("Word.application")
>Is there any way (method) to set this value? (Tools-Macro-Security)
>
>Any hints and/or links will be greatly appreciated.
>Thank you,
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only