View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Malcom Jazz[_4_] Malcom Jazz[_4_] is offline
external usenet poster
 
Posts: 1
Default How to attach function to a custom Menubar?


I have created a custom Menubar with 3 buttons in it. I got the code
from this NG posted by Bert. I would like to attach the UDF I have
written with these buttons. How to attach the UDF function to button?
I want
when clicked on button created, Formula wizard should come up
displaying UDF areguments. It is the popup you can see after click on
fx, selecting a function and click okey.

Menubar code written by Bert is as below(modified to my requirement)

Sub Add_Menubar()
Dim mb As CommandBar
Dim MenuName As String

Dim Cap(1 To 4)
Dim Act(1 To 4)

Cap(1) = "Growth"
Act(1) = Growth 'Growth is custom function or UDF
Cap(2) = "SP Incentive"
Act(2) = "SP_Incentive" 'SP_Incentiveis also UDF function.

MenuName = "&Salary"
MenuBars(xlWorksheet).Menus.Add Caption:=MenuName, befo="Help"

With MenuBars(xlWorksheet).Menus(MenuName).MenuItems
Add Caption:=Cap(1), OnAction:=Act(1)
Add Caption:=Cap(2), OnAction:=Act(2)
End With
End Sub


Regards,
Malcom


--
Malcom Jazz
------------------------------------------------------------------------
Malcom Jazz's Profile: http://www.excelforum.com/member.php...o&userid=15872
View this thread: http://www.excelforum.com/showthread...hreadid=273601