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

Re: Adding menu items to a separate menu section on doc template attach by Word

Word
Wed Aug 11 04:23:29 CDT 2004

G'day "Senapathy" <senapathy.k@siemens.com>,

The best way to achieve this effect is to have that button contained
in the template that must be loaded itself. When that template is
present, so is ze button!

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Senapathy reckoned:

>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
>