Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to Add a command button to the standard commandbar of the visu
Not absolutely sure, but pretty sure you didn't need the second With statment.
Sub Test() With ThisWorkbook.VBProject.VBE.CommandBars("Standard") .Controls.Add _(msoControlButton) .Style = msoButtonWrapCaption .Caption = "Recherche" .OnAction = "Module5.test1" End With End Sub I haven't tried adding anything in the VBE before, but it shouldn't be a lot different that adding to an Excel menu bar. "MichDenis" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to Add a command button to the standard commandbar of the visu
After checking some of the help files, it looks like you will need to use the
Set statement to get this to work. "MichDenis" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command Button visual delay | Excel Programming | |||
Command Button Always Visible in window | Excel Discussion (Misc queries) | |||
Can I run Visual Basic procedure using Excel Visual Basic editor? | Excel Programming | |||
Add standard button on custum commandbar | Excel Programming | |||
Embedded command button doesn't respond in new window | Excel Programming |