View Single Post
  #2   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

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