Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assign Macro to a Menu Item using code
I have seen .OnAction such as:
Item2Sub2.OnAction = "ShowMessage" but How do I "Assign Macro" to a Menu Item in code? Thank you, Steven |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assign Macro to a Menu Item using code
This works for me.
With Application.CommandBars("Cell").Controls.Add(Tempo rary:=True) .Caption = "Your Caption" 'Name the button .OnAction = "YourModule.YourCode" 'Point to the code you want to run .FaceId = 1089 'Adds an icon End With On Thu, 12 Jun 2008 16:53:00 -0700, Steven wrote: I have seen .OnAction such as: Item2Sub2.OnAction = "ShowMessage" but How do I "Assign Macro" to a Menu Item in code? Thank you, Steven |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assign Macro to a Menu Item using code
But it does not show up under the "Assign Macro" of the menu item. I want to
set it up to point to a macro in a different file just as if I had manually gone to View / Toolbars / Customize and right clicked on the created Menu Item and gone to "Assign Macro". I can attach a Macro from any file there but I dont see how you do that from code. "Stephen Newman" wrote: This works for me. With Application.CommandBars("Cell").Controls.Add(Tempo rary:=True) .Caption = "Your Caption" 'Name the button .OnAction = "YourModule.YourCode" 'Point to the code you want to run .FaceId = 1089 'Adds an icon End With On Thu, 12 Jun 2008 16:53:00 -0700, Steven wrote: I have seen .OnAction such as: Item2Sub2.OnAction = "ShowMessage" but How do I "Assign Macro" to a Menu Item in code? Thank you, Steven |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assign Macro to a Menu Item using code
My error:
on the .OnAction you can call a macro from another file just as if you did it manually. The only difference is that you do not see the macro under the "Assign Macro". WOW ... That just made my Friday !!!!!! "Steven" wrote: But it does not show up under the "Assign Macro" of the menu item. I want to set it up to point to a macro in a different file just as if I had manually gone to View / Toolbars / Customize and right clicked on the created Menu Item and gone to "Assign Macro". I can attach a Macro from any file there but I dont see how you do that from code. "Stephen Newman" wrote: This works for me. With Application.CommandBars("Cell").Controls.Add(Tempo rary:=True) .Caption = "Your Caption" 'Name the button .OnAction = "YourModule.YourCode" 'Point to the code you want to run .FaceId = 1089 'Adds an icon End With On Thu, 12 Jun 2008 16:53:00 -0700, Steven wrote: I have seen .OnAction such as: Item2Sub2.OnAction = "ShowMessage" but How do I "Assign Macro" to a Menu Item in code? Thank you, Steven |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assign Macro to a Menu Item using code
On Fri, 13 Jun 2008 08:14:05 -0700, Steven
wrote: You're welcome. My error: on the .OnAction you can call a macro from another file just as if you did it manually. The only difference is that you do not see the macro under the "Assign Macro". WOW ... That just made my Friday !!!!!! "Steven" wrote: But it does not show up under the "Assign Macro" of the menu item. I want to set it up to point to a macro in a different file just as if I had manually gone to View / Toolbars / Customize and right clicked on the created Menu Item and gone to "Assign Macro". I can attach a Macro from any file there but I dont see how you do that from code. "Stephen Newman" wrote: This works for me. With Application.CommandBars("Cell").Controls.Add(Tempo rary:=True) .Caption = "Your Caption" 'Name the button .OnAction = "YourModule.YourCode" 'Point to the code you want to run .FaceId = 1089 'Adds an icon End With On Thu, 12 Jun 2008 16:53:00 -0700, Steven wrote: I have seen .OnAction such as: Item2Sub2.OnAction = "ShowMessage" but How do I "Assign Macro" to a Menu Item in code? Thank you, Steven |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro does not assign to menu? | Excel Discussion (Misc queries) | |||
how do I assign a CTRL + shortcut key to a menu item (paste speci. | Excel Discussion (Misc queries) | |||
Assign macro to each item of a drop-down list or combo box - how? | Excel Programming | |||
Can I assign a macro to each item in a drop-down list? | Excel Programming | |||
Selecting Menu Item by VBA Code | Excel Programming |