S
Senapathy
Hello all,
I just finished the nitty gritty of checking through a doc template for
valid bookmark entries. This is working fine.
Now I want to add a menu item whenever the doc template is attached (added
through Templates and Add-ins)
For this, I over rode the subroutine Autoexec and here I tried to create the
menu item.
I am not able to figure out how to add a new menu section itself.
Currently I am trying out like this:
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "Review"
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Find Invalid Comments"
ctrl1.Style = msoButtonCaption
Set ctrl2 = newMenu.Controls.Add(Type:=msoControlButton, ID:=2)
ctrl2.Caption = "Display Review Summary"
ctrl2.Style = msoButtonCaption
The behaviour is that the menu item "Review" is now appearing after the
current menu bar. I want an own separate section for this menu item. (I
know, the problem is with using ActiveMenuBar, but any other approach of
adding a new MenuBar didn't seem to work for me)
Also, I am not able to delete this menu item in the Autoexit subroutine. I
am not able to figure out how to use the CommandBar -> Delete method to
achieve this.
Any pointers for the 2 problems above, anyone?
Thanks and regards,
Sena
I just finished the nitty gritty of checking through a doc template for
valid bookmark entries. This is working fine.
Now I want to add a menu item whenever the doc template is attached (added
through Templates and Add-ins)
For this, I over rode the subroutine Autoexec and here I tried to create the
menu item.
I am not able to figure out how to add a new menu section itself.
Currently I am trying out like this:
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, _
Temporary:=True)
newMenu.Caption = "Review"
Set ctrl1 = newMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Find Invalid Comments"
ctrl1.Style = msoButtonCaption
Set ctrl2 = newMenu.Controls.Add(Type:=msoControlButton, ID:=2)
ctrl2.Caption = "Display Review Summary"
ctrl2.Style = msoButtonCaption
The behaviour is that the menu item "Review" is now appearing after the
current menu bar. I want an own separate section for this menu item. (I
know, the problem is with using ActiveMenuBar, but any other approach of
adding a new MenuBar didn't seem to work for me)
Also, I am not able to delete this menu item in the Autoexit subroutine. I
am not able to figure out how to use the CommandBar -> Delete method to
achieve this.
Any pointers for the 2 problems above, anyone?
Thanks and regards,
Sena