Question

I'm currently trying to disable some buttons on the menu bar in word 2k3 but I have no clue on how to do so, from what I can find online it seems that i need to call the function "EnableMenuItem" from the user32.dll but it doesnt seem to work. Are there any other options available? I want to disable copy/paste/cut without the use of macros to intercept the calls.

thank you all for your help :)

Gonçalo

Was it helpful?

Solution

You'll have to iterate through the app.commandbars collection to find the specific commandbar (in this case,the EDIT MENU) and then interate through the commands to find the specific menu items, then you should be able to hook the click events, or disable the buttons (CommandBarButton objects have an ENABLED property you can set, I believe you can also set VISIBLE on them).

Be aware that in different languages, the Caption can change, so it's best to key of the ID property.

Here's a post of how to get those names and ID's

http://support.microsoft.com/kb/243988

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top