Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Help with a Menu Item .OnAction property
I have added a new menu to Excel called "Budget"
Within the worksheet that this menu will act on are 5 named ranges whose names are stored in the string RngName, e.g. the first named range is in RngName(1), the 2nd in RngName(2), etc. There is a corresponding menu item in the menu to each of these ranges and depending on which is selected, the same set of actions will occur to that range. When I'm setting up the menu can I do the following (I don't have WIndows vs of Excel to check this at home) Set HelpMenu = CommandBars(1).FindControl(Id:=30010) If HelpMenu = Nothing Then Set NewMenu = Commandbars(1).Controls.AddType:=msoControlPopup, Temporary:=True) Else Set NewMenu = Commandbars(1).Controlls.AddType:=msoControlPopup, _ Befo=HelpMenu, Temporary:=True) End If NewMenu.Caption = "&Budget" For i = 1 to 5 Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton) With MenuItem ..Caption = MIStr(i) ..OnAction = Macro1(RngName(i)) If Action(i) = False Then ..Enabled = False Else ..Enabled = True End If End With I guess my question is, will the .OnAction properly pass the the RngName(i) string that holds the range name? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
OnAction menu item property coding | Excel Programming | |||
Button Selection OnAction property | Excel Programming | |||
Setting OnAction of custom menu item? | Excel Programming | |||
Find OnAction property | Excel Programming |