Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro does not assign to menu? Robert24 Excel Discussion (Misc queries) 2 October 2nd 08 04:39 AM
how do I assign a CTRL + shortcut key to a menu item (paste speci. PaulGB Excel Discussion (Misc queries) 1 July 14th 08 03:19 AM
Assign macro to each item of a drop-down list or combo box - how? jbp20717[_3_] Excel Programming 1 July 27th 05 11:17 AM
Can I assign a macro to each item in a drop-down list? jbp20717 Excel Programming 5 July 4th 05 01:38 PM
Selecting Menu Item by VBA Code PosseJohn Excel Programming 2 December 5th 04 12:24 PM


All times are GMT +1. The time now is 01:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"