View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
michdenis michdenis is offline
external usenet poster
 
Posts: 135
Default how to Add a command button to the standard commandbar of the visual editor window

Hi,

This code add a button to the "standard" command bar of the
visual editor window ?

Does someone know why it does not work ?
and what to change to make it work.

'---------------------
Sub Test()

With ThisWorkbook.VBProject.VBE.CommandBars("Standard")
With .Controls.Add(msoControlButton)
.Style = msoButtonWrapCaption
.Caption = "Recherche"
.OnAction = "Module5.test1"
End With
End With

End Sub

'---------------------
Sub test1()
MsgBox "Good afternoon"
End Sub
'---------------------

Thank in advance for you time.

Salutations