View Single Post
  #4   Report Post  
Gord Dibben
 
Posts: n/a
Default

fick

Example code from

http://support.microsoft.com/default...EN-US;Q166755&

The .OnAction step runs the macro assigned to that item.

Sub menuItem_Create()
With CommandBars("Worksheet menu bar").Controls("Tools")
.Controls.Add(Type:=msoControlButton, Befo=1).Caption = _
"Custom1"
.Controls("Custom1").OnAction = "Code_Custom1"
End With
End Sub

NOTE: This is the code that runs when you click Custom1.

Sub Code_Custom1()
MsgBox "you clicked Custom1"
End Sub

You may also take a look at John Walkenbach's MENUMAKR.xls for creating menus.

http://j-walk.com/ss/excel/tips/tip53.htm


Gord

On 13 Dec 2004 07:46:09 -0800, "fick" wrote:

Thanks Gord

I know the best way to fix this problem is by creating custom toolbars
in VBA but how do you link the Macros?????

Thanks fick