View Full Version : how to disable Open() with the Ribbon UI

07-01-2009, 09:26 AM
I am writing automation code that needs to work in all versions of Word from 2000 through 2007. I want to prevent the user from opening another document (new or existing) while they are editing the current one. The only way I've found is to disable the menu options. Obviously, the code that works for earlier versions doesn't work in 2007. How does one do this under automation with the Ribbon UI?

07-01-2009, 09:52 AM
Use the CustomUI editor to add the XML to a DOCM file

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<command idMso="FileOpen"enabled="false"/>

There might be some other ways to open a file, but this is a start


07-01-2009, 01:12 PM
Sorry, I need to to back a step further. I don't know much about 'DOCM' or XML. Can this be done under automation even though not all workstations will have Internet access? I was hoping there might be something that temporarily disables the option... Something like

oWord.CommandBars(<whatever>).Enabled = False

that works so well with earlier versions. I just can't figure out what the <whatever> options are. But perhaps they don't exist...