Custom Toolbar - ZOOM
Posted by Robb on February 06, 2002 2:17 PM
At the start of my program I hide all Excel ToolBars, then I dynamically create my custom TOOLBAR using the code below. I need the Zoom Custom Combobox so the user can customize the view of the screen. This is what I have so far and it works fine except for the zoom cbo. All I get is the "Zoom" word without the combobox.
' Location for menu data
Set MenuSheet = ThisWorkbook.Sheets("Colour & Size Lists")
' Create the CommandBar called "Custom"
Set cbar1 = CommandBars.Add(Name:="Custom", Position:=msoBarTop)
' Initialize the row counter
Row = 400
' Add the control data stored on the MenuSheet
Do Until IsEmpty(MenuSheet.Cells(Row, 1))
With MenuSheet
Caption = .Cells(Row, 1)
FaceId = .Cells(Row, 2)
OnAction = .Cells(Row, 3)
Style = .Cells(Row, 4)
TooltipText = .Cells(Row, 5)
BeginGroup = .Cells(Row, 6)
Enabled = .Cells(Row, 7)
End With
' Create the controls for "Custom" CommandBar
Set MenuObject = Application.CommandBars("Custom").Controls _
.Add(Type:=msoControlButton, Before:=1, _
temporary:=True)
MenuObject.Caption = Caption
MenuObject.FaceId = FaceId
MenuObject.OnAction = OnAction
MenuObject.Style = Style
MenuObject.TooltipText = TooltipText
MenuObject.BeginGroup = BeginGroup
MenuObject.Enabled = Enabled
' Move down a row to get the parameters for the next control
Row = Row + 1
Loop
' Show the "Custom" CommandBar
cbar1.Visible = True