T
Tom Joseph
I am trying to load a floating command bar when I open a workbook using Sub
AutoOpen() in Excel 2003. Also, Private Sub Workbook_Open() does not seem to
work either. It works when I manually run the code.
Can someone please help. Thanks.
Sub AutoOpen()
Dim c As CommandBar
Dim cb As CommandBarButton
Set c = Application.CommandBars.Add("Dashboard Controls", _
msoBarFloating, False, True)
c.Enabled = True
c.Visible = True
Set cb = c.Controls.Add(msoControlButton, 2)
cb.Style = msoButtonCaption
cb.Caption = "caption button with a long caption"
Set cb = c.Controls.Add(msoControlButton, 3)
cb.Style = msoButtonIcon
cb.Caption = "icon button"
Set cb = c.Controls.Add(msoControlButton, 4)
cb.Style = msoButtonIconAndCaption
cb.Caption = "icon and caption button"
End Sub
AutoOpen() in Excel 2003. Also, Private Sub Workbook_Open() does not seem to
work either. It works when I manually run the code.
Can someone please help. Thanks.
Sub AutoOpen()
Dim c As CommandBar
Dim cb As CommandBarButton
Set c = Application.CommandBars.Add("Dashboard Controls", _
msoBarFloating, False, True)
c.Enabled = True
c.Visible = True
Set cb = c.Controls.Add(msoControlButton, 2)
cb.Style = msoButtonCaption
cb.Caption = "caption button with a long caption"
Set cb = c.Controls.Add(msoControlButton, 3)
cb.Style = msoButtonIcon
cb.Caption = "icon button"
Set cb = c.Controls.Add(msoControlButton, 4)
cb.Style = msoButtonIconAndCaption
cb.Caption = "icon and caption button"
End Sub