I'm having problems executing macros using a Combobox within Floating Toolbar. I was successful using the AddItem command to populate the dropdown list. I wrote a separate procedure to execute the macros. Its strange but when "First Item", "Second Item" or "Third Item are selected, they all execute Macro3.
Sub Cbar()
On Error Resume Next
Set myBar = CommandBars.Add("Reports")
With myBar.Controls.Add(msoControlComboBox)
.Caption = "Special Item Report"
.AddItem "First Item", 1
.OnAction = "First_Item"
.AddItem "Second Item", 2
.OnAction = "Second_Item"
.AddItem "Third Item", 3
.OnAction = "Third_Item"
.DropDownLines = 10
.DropDownWidth = 75
.ListHeaderCount = 0
.Caption = "Special Item Report"
.FaceId = 265
End With
Set newcombo = CommandBars("Custom")
Public Sub First_Item()
Call Macro1
End Sub
Public Sub Second_Item()
Call Macro2
End Sub
Public Sub Third_Item()
Call Macro3
End Sub
Any help would be greatly appreciated
MJK
Sub Cbar()
On Error Resume Next
Set myBar = CommandBars.Add("Reports")
With myBar.Controls.Add(msoControlComboBox)
.Caption = "Special Item Report"
.AddItem "First Item", 1
.OnAction = "First_Item"
.AddItem "Second Item", 2
.OnAction = "Second_Item"
.AddItem "Third Item", 3
.OnAction = "Third_Item"
.DropDownLines = 10
.DropDownWidth = 75
.ListHeaderCount = 0
.Caption = "Special Item Report"
.FaceId = 265
End With
Set newcombo = CommandBars("Custom")
Public Sub First_Item()
Call Macro1
End Sub
Public Sub Second_Item()
Call Macro2
End Sub
Public Sub Third_Item()
Call Macro3
End Sub
Any help would be greatly appreciated
MJK