A
Alex
Hello people,
I can easily manipulate the MS-Word menu items using Application.CommandBars.ActiveMenuBar.Controls.
It works without problems both from COM add-ins and VBA macros.
However, if the Word window is hosted in another application it no longer works.
Try it yourself:
1) Open a Word document in Internet Explorer
2) display Application.CommandBars.ActiveMenuBar.Controls(1).Caption
You get "&File", which is the first menu item.
3) Application.CommandBars.ActiveMenuBar.Controls(1).Delete
Notice that the menu in IE did not change.
4) Sanity check: display Application.CommandBars.ActiveMenuBar.Controls(1).Caption again
Now it is "&Edit", the 2nd menu item.
So Word thinks that the menu item has been deleted but IE does not know anything about it!
Same problem trying to add, enable/disable or show/hide menu items.
No effect. Zilch. Nada.
Here's what I am trying to do:
I have a Word add-in written in C# that inserts its own menus.
Some times I need to disable (or hide) them based on the current state of the document.
Unfortunately, if the Word window is hosted in another application (IE, DsoFramer, you name it) it does not work.
Any help is appreciated!
Thanks,
Alex.
I can easily manipulate the MS-Word menu items using Application.CommandBars.ActiveMenuBar.Controls.
It works without problems both from COM add-ins and VBA macros.
However, if the Word window is hosted in another application it no longer works.
Try it yourself:
1) Open a Word document in Internet Explorer
2) display Application.CommandBars.ActiveMenuBar.Controls(1).Caption
You get "&File", which is the first menu item.
3) Application.CommandBars.ActiveMenuBar.Controls(1).Delete
Notice that the menu in IE did not change.
4) Sanity check: display Application.CommandBars.ActiveMenuBar.Controls(1).Caption again
Now it is "&Edit", the 2nd menu item.
So Word thinks that the menu item has been deleted but IE does not know anything about it!
Same problem trying to add, enable/disable or show/hide menu items.
No effect. Zilch. Nada.
Here's what I am trying to do:
I have a Word add-in written in C# that inserts its own menus.
Some times I need to disable (or hide) them based on the current state of the document.
Unfortunately, if the Word window is hosted in another application (IE, DsoFramer, you name it) it does not work.
Any help is appreciated!
Thanks,
Alex.