Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I created a commandBar
code is given below when I rightclick the menu is invoked. But when I click on an item, my function is not called (specified in the OnAction = ....) I have another question is there any specific place we write these codes? when I tried Set myPopup = CommandBars.Add(Name:="MyBar", Position:=msoBarPopup) in a test workbook it gives errors saying, procedure call or argument is wrong. the same code works in my book. what am my missing to notice? Thank you for the help MVM --------------- this is in standard module -------------- Public Sub CreateMyPopup() If Not CommandBars("MyBar") Is Nothing Then CommandBars("MyBar").Delete End If Set myPopup = CommandBars.Add(Name:="MyBar", Position:=msoBarPopup) End Sub --------------- --------------- thisworkbook -----fills the controls in the commandbar Public Sub PopulateMyPopup() Dim c As Range Call SetRanges Call CreateMyPopup myPopup.Enabled = True For Each c In AcctRange.Columns Set myMnu = myPopup.Controls.Add(Type:=msoControlButton, temporary:=True) With myMnu .Caption = c.Cells(1, 1).Value & " - " & c.Cells(3, 1).Value ' .DescriptionText = "MMMM" .Tag = c.Cells(1, 1).Value .Enabled = True .Visible = True ' .OnAction = "GetCode(Expenses.Cells(16, 10)," & .Caption & ")" .OnAction = "Expenses.Cells(16, 10).value = " & Left(.Caption, 1) & ")" .Execute End With Next c End Sub --------------- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MS Query Direct Invoking? | Excel Discussion (Misc queries) | |||
Invoking autofilter 'automatically' | Excel Discussion (Misc queries) | |||
Invoking Mail Merge from Excel | Excel Programming | |||
Excel Macro Code invoking InputBox. | Excel Programming |