W
Wheat
I created a custom toolbar and add a button to call a
function. The toolbar was created and the button works
fine. The only problem is I can't get the caption to show
on the button. The code is below:
Public Sub CreateQCToolbar()
Dim bars As CommandBars
Dim bar As CommandBar
Dim barcontrols As CommandBarControls
Dim barcontrol As CommandBarControl
Dim button As CommandBarButton
Set bars = Excel.CommandBars
For Each bar In bars
If bar.Name = "A&E QC" Then
bar.Delete
End If
Next
bars.Add "A&E QC", msoBarTop, False, False
Set bar = bars("A&E QC")
bar.Visible = True
Set bars = Nothing
Set barcontrols = bar.Controls
Set bar = Nothing
barcontrols.Add msoControlButton, 1, , , False
Set barcontrol = barcontrols(1)
With barcontrol
.Caption = "Refresh QC Sheet"
.Enabled = True
.OnAction = "Refresh"
.Visible = True
End With
Set button = barcontrol
With button
.FaceId = 39
End With
Set barcontrols = Nothing
Set barcontrol = Nothing
Set button = Nothing
End Sub
Currently, only the FaceID (-->) is showing. Any ideas
why the caption won't show? Thanks!
function. The toolbar was created and the button works
fine. The only problem is I can't get the caption to show
on the button. The code is below:
Public Sub CreateQCToolbar()
Dim bars As CommandBars
Dim bar As CommandBar
Dim barcontrols As CommandBarControls
Dim barcontrol As CommandBarControl
Dim button As CommandBarButton
Set bars = Excel.CommandBars
For Each bar In bars
If bar.Name = "A&E QC" Then
bar.Delete
End If
Next
bars.Add "A&E QC", msoBarTop, False, False
Set bar = bars("A&E QC")
bar.Visible = True
Set bars = Nothing
Set barcontrols = bar.Controls
Set bar = Nothing
barcontrols.Add msoControlButton, 1, , , False
Set barcontrol = barcontrols(1)
With barcontrol
.Caption = "Refresh QC Sheet"
.Enabled = True
.OnAction = "Refresh"
.Visible = True
End With
Set button = barcontrol
With button
.FaceId = 39
End With
Set barcontrols = Nothing
Set barcontrol = Nothing
Set button = Nothing
End Sub
Currently, only the FaceID (-->) is showing. Any ideas
why the caption won't show? Thanks!