Adding buttons to a new menu bar

G

Greegan

I am cross posting ( i think ) because the server seems to have an issue
with the other newsgroup (possibly)

Hello everyone I hope someone can help me here.

I have a problem at work with my ID resetting and my menu bar (my custom
menu bar) has the menus but none of my buttons or the menu lists stay with
the ID change...

This is something that is too small a problem for our IT people to work out
so I did a fix for it. I have a script itself run and add the macros to the
menu lists. It works with the following...

Dim CmdBar As CommandBar
Dim CmdBarMenu As CommandBarControl
Dim CmdBarMenuItem As CommandBarControl
Set CmdBar = Application.CommandBars("My Custom Menu Bar")
Set CmdBarMenu = CmdBar.Controls("Software")
Set CmdBarMenuItem = CmdBarMenu.Controls.Add
With CmdBarMenuItem
.Caption = "5-Digit Zip Code Format"
.OnAction = "'" & ThisWorkbook.Name & "'!C200010"
.Tag = "SomeString"
End With


This is repeated for each menu I have manually typed in the bar, "Software"
being one of them.

So I'm able to add the menu lists to menus I've entered as the one mentioned
above, however I don't know how to add Buttons to my menu bar and keep the
assigned macro linked to the command (string?).

Can anyone assist with this? I need something like the above script but it
needs to add the macro to the button. I would imagine its a bit different
because you need to identify the button image but man would it help if
someone out there could assist.

Thank you ahead of time.

G
 

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