View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Stephen Newman[_2_] Stephen Newman[_2_] is offline
external usenet poster
 
Posts: 18
Default 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