OzzieTheOwl
Technical User
Hi
I have the following code that should be putting a command button into a command bar.
But I am getting the following error message
On the line
Am I missing something?
Cheers
Barney
I have the following code that should be putting a command button into a command bar.
Code:
Private Sub Workbook_Open()
Set cbrGraphs = Application.CommandBars.Add
cbrGraphs.Name = "Graph Buttons"
cbrGraphs.Position = msoBarTop
With cbrGraphsControls
Set cbcCreateGraphs = .Add(msoControlButton)
cbcCreateGraphs.Caption = "|Create Graphs|"
cbcCreateGraphs.DescriptionText = "Click to Create Graphs"
cbcCreateGraphs.Style = msoButtonCaption
cbcCreateGraphs.BeginGroup = True
cbcCreateGraphs.OnAction = "cmdCreateGrphs"
End With
cbrGraphs.Visible = True
End Sub
But I am getting the following error message
Run Time Error 5, Invalid Call or Procedure
On the line
Code:
cbrGraphs.Name = "Graph Buttons"
Am I missing something?
Cheers
Barney