C
Craig Brandt
I am trying to create a floating toolbar on the fly with dropdown menus and
also first level buttons. I cannot figure out how to assign an icon to a
button. Here is a piece of the code where I would like to assign an icon to
the Calculate button. How do I assign the ICON picture?
Help would be appreciated.
Thanks
Craig
Public Sub FltgToolbar()
'
' Establishes a Floating Toolbar for this workbook only.
Dim RvwBar As Office.CommandBar
' Close previous Toolbar
On Error Resume Next
Application.CommandBars("Returns").Delete
With Application.CommandBars.Add
.Name = "Returns"
.Left = 300
.Top = 200
.Visible = True
.Position = msoBarFloating
' Download Drop Downs
With .Controls.Add(Type:=msoControlPopup)
.Caption = "Downloads"
.TooltipText = "Imports Data into this WorkBook"
With .Controls.Add(Type:=msoControlButton)
.OnAction = "DLToday"
.Caption = "Import Current"
End With
With .Controls.Add(Type:=msoControlButton)
.OnAction = "DLPrev"
.Caption = "Import Previous"
End With
End With
' Calc Button
With .Controls.Add(Type:=msoControlButton)
.Caption = "Calculate"
.OnAction = "Calculate"
.TooltipText = "Calculates returns based on current data"
End With
End With
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=109
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=4
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=1849
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=436
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=422
End Sub
also first level buttons. I cannot figure out how to assign an icon to a
button. Here is a piece of the code where I would like to assign an icon to
the Calculate button. How do I assign the ICON picture?
Help would be appreciated.
Thanks
Craig
Public Sub FltgToolbar()
'
' Establishes a Floating Toolbar for this workbook only.
Dim RvwBar As Office.CommandBar
' Close previous Toolbar
On Error Resume Next
Application.CommandBars("Returns").Delete
With Application.CommandBars.Add
.Name = "Returns"
.Left = 300
.Top = 200
.Visible = True
.Position = msoBarFloating
' Download Drop Downs
With .Controls.Add(Type:=msoControlPopup)
.Caption = "Downloads"
.TooltipText = "Imports Data into this WorkBook"
With .Controls.Add(Type:=msoControlButton)
.OnAction = "DLToday"
.Caption = "Import Current"
End With
With .Controls.Add(Type:=msoControlButton)
.OnAction = "DLPrev"
.Caption = "Import Previous"
End With
End With
' Calc Button
With .Controls.Add(Type:=msoControlButton)
.Caption = "Calculate"
.OnAction = "Calculate"
.TooltipText = "Calculates returns based on current data"
End With
End With
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=109
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=4
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=1849
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=436
Application.CommandBars("Returns").Controls.Add Type:=msoControlButton,
ID:=422
End Sub