I have create a Command Bar, my problem I'm trying to understand is this
1.Can you amend the font colour of the any Captions on the CommandBar?
2.How can I get the Caption to pick up from a range and use the range name as the Caption?
I have named a range in a worksheet that I want to pick up and use as the range
Below is my CommandBar code
Sub ComBar()
Dim cmdBar As CommandBar
Dim cmdPopup As CommandBarPopup
Dim cmdButton As CommandBarButton
DeleteComBar
Set cmdBar = CommandBars.Add(Name:="Tracker", _
Position:=msoBarFloating, Temporary:=True)
With cmdBar
.Top = 150
.Left = 50
Set cmdPopup = .Controls.Add(Type:=msoControlPopup)
With cmdPopup
.Caption = " Last View "
.BeginGroup = True
Set cmdButton = .Controls.Add(Type:=msoControlButton)
With cmdButton
.Caption = Range("LastSheetViewed").Select
.Style = msoButtonCaption
.BeginGroup = True
'I will use the range to build code to select which sheet the report will go to
.OnAction = "LastView"
End With
Set cmdButton = .Controls.Add(Type:=msoControlButton)
With cmdButton
.Caption = " Home "
.Style = msoButtonCaption
''' msoButtonAutomatic, msoButtonIcon, msoButtonCaption, or msoButtonIconandCaption
.BeginGroup = True
.OnAction = "GoToHome"
End With
Set cmdButton = .Controls.Add(Type:=msoControlButton)
With cmdButton
.Caption = " Download Tracker "
.Style = msoButtonCaption
.BeginGroup = True
.OnAction = "Download"
End With
.Width = 1000
.Visible = True
End With
End Sub
Sub DeleteComBar()
On Error Resume Next
CommandBars("Tracker").Delete
On Error GoTo 0
End Sub
Bookmarks