ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Adding buttons to a new menu bar (https://www.excelbanter.com/excel-worksheet-functions/82052-adding-buttons-new-menu-bar.html)

Greegan

Adding buttons to a new menu bar
 
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







Ron de Bruin

Adding buttons to a new menu bar
 
Hi Greegan

See this pages for examples

http://support.microsoft.com/default...02&Product=xlw
How to customize menus and menu bars in Excel

http://www.j-walk.com/ss/excel/tips/tip53.htm
Creating Custom Menus (John Walkenbach) TIP

http://www.erlandsendata.no/english/...oadcommandbars
Ole P. Erlandsen's Web Site (Example workbooks)

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Greegan" wrote in message ...
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










All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com