Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word Automation - Setting Macro Security Level
Message
 
To
30/07/2003 18:19:57
Fabian Belo
Independent Developer
Argentina
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00815165
Message ID:
00815452
Views:
8
This message has been marked as a message which has helped to the initial question of the thread.
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
Map
View

Click here to load this message in the networking platform