Custom menus and macros

R

Roddie

The knowledge base
(http://support.microsoft.com/default.aspx?scid=kb;en-us;141688) kindly
shows a macro to add a menu but then doesn't tell you how to attach macros
to the menu items.

It includes the code:
With mymenu
.Add "Item1" 'Adds Item1 to Submenu
.Add "Item2" 'Adds Item2 to Submenu
.Add "Item3" 'Adds Item3 to Submenu
End With

Then says:
"The OnAction argument of the Add Method is optional, and it specifies the
name of the macro that is run when the new menu item is selected."

but it doesn't explain how to attach macros to Item1, Item2 and Item3. I've
tried all sorts of permutations with "onaction" to no avail.

Can anyone enlighten me.

Thanks

Roddie Grant
(e-mail address removed)
 
J

JE McGimpsey

but it doesn't explain how to attach macros to Item1, Item2 and Item3. I've
tried all sorts of permutations with "onaction" to no avail.

One way:

With mymenu
With .Add("Item1")
.OnAction = "Macro1"
End With
With .Add("Item2" ) 'Adds Item2 to Submenu
.OnAction = "Macro2"
End With
With .Add("Item3") 'Adds Item3 to Submenu
.OnAction = "Macro3"
End With
End With
 
R

Roddie

One way:

With mymenu
With .Add("Item1")
.OnAction = "Macro1"
End With
With .Add("Item2" ) 'Adds Item2 to Submenu
.OnAction = "Macro2"
End With
With .Add("Item3") 'Adds Item3 to Submenu
.OnAction = "Macro3"
End With
End With

Excellent. Many thanks.

Roddie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top