Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How does the Gen field edit disable saving of Word docs?
Message
From
07/04/2001 11:59:06
 
 
To
03/04/2001 21:46:34
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00491659
Message ID:
00493224
Views:
27
What? No answer after 4 days?

OK fine...I've done some more research and found out a few things, just in case someone is interested...

Using nested references to commandbar objects, it's possible to get access to Word Menu Bar controls and the controls contained in each menu. All of these controls has an 'enabled' property which can, in most cases, be set .F. For example:
owrd=createobject('word.application')
odoc=owrd.documents.open(myalreadyexistingdoc)
owrd.commandbars('Menu Bar').controls('File').controls('Save As...').enabled=.F.
owrd.visible=.T.
The above disables the 'Saveas' command in the File menu. However, there is a dangerous pitfall with this method...

If you disable a menu bar control it will remain disabled in future instances of running Word. I even found that I could make the Menu Bar invisible, but if you don't make it visible before closing Word...All future instances of Word (all...not just those you run with OLE) won't have a menu bar! Presumabley some registry ( or normal.dot template?) variable is being set.

Here's a test of your prowess. Open up word with the Menu Bar invisible and try to do anything except quit. Try, for example, to make the Menu Bar visible!. (Good luck!)

Needless to say, mucking with Word this way is very dangerous since your well intentioned re-enabling of the Menu Bar (or SaveAS or any other control) might not be executed because of premature termination of your application. In such a case, you'll leave your victims high and dry and probably unable to figure out why they can't do anything in Word anymore!
"The Iron Fish: The water is cold...but the fish don't mind"
...Jay Jenks, boyhood chum
Previous
Reply
Map
View

Click here to load this message in the networking platform