ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to attach function to a custom Menubar? (https://www.excelbanter.com/excel-programming/315209-how-attach-function-custom-menubar.html)

Malcom Jazz[_4_]

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



All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com