OnAction property not working

  • Thread starter Thread starter Luc Benninger
  • Start date Start date
L

Luc Benninger

Hi
I use the code below to insert a new commandbar button to the standard
commandbar of the VBA editor. But the OnAction property seems not to work.
Why? Using Excel 2003.
Thanks for any hints, Luc

' ******************************************
Public Sub CreateButton()
With Application.VBE.CommandBars("Standard")
.Visible = False
With .Controls.Add(msoControlButton, , , 1, True)
.FaceId = 123
.Style = msoButtonIcon
.OnAction = "DoIt"
End With
.Visible = True
End With
End Sub

Public Sub DoIt()
MsgBox "done"
End Sub
 
Andy, thanks for your response. But I didn't find any example about the VBE
menu. I have not problems dealing with Excel command bars. Any other hints?
 
Back
Top