F
fausto
I have a problem...
I have created a custombar with a custombutton. I have a sub named MySub.
I set custombutton OnAction property with a value "MySub", but when I click
on it Excel give me a follow message: Impossible Locate MySub macro.
Can someone help me? Sorry for my english...
Dim cmdBars As CommandBars
Dim Bar As CommandBar
Dim btnBar As CommandBarButton
Set cmdBars = Application.CommandBars
Set Bar = cmdBars.Add
Bar.Name = "Export"
Bar.Position = msoBarTop
Bar.Visible = True
'******************************
Set btnBar = Bar.Controls.Add
btnBar.Style = msoButtonCaption
btnBar.FaceId = 2
btnBar.Caption = "Esporta"
btnBar.Width = 80
btnBar.Visible = True
btnBar.OnAction = "MySub"
Sub MySub()
'My lines of code
End Sub
I have created a custombar with a custombutton. I have a sub named MySub.
I set custombutton OnAction property with a value "MySub", but when I click
on it Excel give me a follow message: Impossible Locate MySub macro.
Can someone help me? Sorry for my english...
Dim cmdBars As CommandBars
Dim Bar As CommandBar
Dim btnBar As CommandBarButton
Set cmdBars = Application.CommandBars
Set Bar = cmdBars.Add
Bar.Name = "Export"
Bar.Position = msoBarTop
Bar.Visible = True
'******************************
Set btnBar = Bar.Controls.Add
btnBar.Style = msoButtonCaption
btnBar.FaceId = 2
btnBar.Caption = "Esporta"
btnBar.Width = 80
btnBar.Visible = True
btnBar.OnAction = "MySub"
Sub MySub()
'My lines of code
End Sub