Problem with creating submenus

P

Peter Elsen

Hello

with the following Code I make a new entry to the Text-Contextmenu in Word:

CommandBars("Text").Controls.Add Type:=msoControlPopup
CommandBars("Text").Controls(CommandBars("Text").Controls.Count).Caption =
"Textbausteine"

I want to create new menuitems within this new menu "Textbausteine".
But I don't know, how to add a ControlButton to this new CommandBar.
When I create a macro automatic by word, I get the following result:
CommandBars("Untermenü 12").Controls.Add Type:=msoControlButton,
Before:=1

The number of the indexname "Untermenü 12" (in the english version it should
be "Submenu 12") changes by the number of items in the main menu. When I
list all CommandBars ("For Each cb in
CommandBars..."), I never get a CommandBar named "Untermenü 12". Who can
offer a solution?

Thank you!

Peter Elsen
 
W

Word Heretic

G'day "Peter Elsen" <[email protected]>,

It's easier if you assign the results of the functions, eg:

Dim CB as CommandBar
Dim Ctrl as CommandBarControl

Set CB = CommandBars.Add...
Set Ctrl = Cb.Controls.add ...

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

steve from wordheretic.com (Email replies require payment)


Peter Elsen reckoned:
 

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