Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word Automation - Setting Macro Security Level
Message
 
To
31/07/2003 15:47:24
Fabian Belo
Independent Developer
Argentina
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00815165
Message ID:
00815615
Views:
10
Is it visible? It should be visible to be activated.
If oword.visible
*do it...

Sorry if I misunderstood your question: I assumed you need to hide code in macro making it not available for user. But it will not remove the warning dialog (...macro may contain viruses...) when opening the document.


>Thank you Yuri. I'll let you know.
>BTW,
oWord.APPLICATION.activate
is always throwing "OLE IDispatch exception code 0 from Microsoft Word: Cannot activate application...
>(Office XP-SP_All)
>
>
>>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