Bug ? Add custom buttons to the "Insert" command bar -- Word 2003

J

Joey Che

Hi,
I am developing a office addin with vs2003(c++), but some behaviors o
the word addin are strange.So i write some vba code to verify them.

Se
newItem1=CommandBars("Insert").Controls.Add(Type:=msoControlButton)
newItem1.Caption = "1111"

Se
newItem2=CommandBars("Insert").Controls.Add(Type:=msoControlButton)
newItem2.Caption = "2222"

Se
newItem3=CommandBars("Insert").Controls.Add(Type:=msoControlButton)
newItem3.Caption = "3333"

The result is i do added three control buttons under the "Insert" menu
but the first button's caption is 3333, and the others' are blank.

The same code is work well under the "View" menu.So, is it a bug o
word or i miss something?

Thanks,

Joe
 
C

Cindy M.

Hi Joey,

It would help if you show us the complete procedure. I'm missing two
things that would give me a better idea what the problem might be

1. The type declarations of the "new items"

2. Where these new items are being saved
(Application.CustomizationContext)

Without that information, trying to trouble-shoot commandbars in Word is
something of a lottery...
I am developing a office addin with vs2003(c++), but some behaviors of
the word addin are strange.So i write some vba code to verify them.

Set
newItem1=CommandBars("Insert").Controls.Add(Type:=msoControlButton)
newItem1.Caption = "1111"

Set
newItem2=CommandBars("Insert").Controls.Add(Type:=msoControlButton)
newItem2.Caption = "2222"

Set
newItem3=CommandBars("Insert").Controls.Add(Type:=msoControlButton)
newItem3.Caption = "3333"

The result is i do added three control buttons under the "Insert" menu,
but the first button's caption is 3333, and the others' are blank.

The same code is work well under the "View" menu.So, is it a bug of
word or i miss something?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top