Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Button visual delay chuckm Excel Programming 4 March 28th 07 12:13 AM
Command Button Always Visible in window avveerkar Excel Discussion (Misc queries) 2 January 11th 06 12:21 PM
Can I run Visual Basic procedure using Excel Visual Basic editor? john.jacobs71[_2_] Excel Programming 3 December 26th 05 02:22 PM
Add standard button on custum commandbar Jos Vens[_2_] Excel Programming 6 October 31st 05 11:04 PM
Embedded command button doesn't respond in new window Jim Cable Excel Programming 0 February 20th 04 03:38 PM


All times are GMT +1. The time now is 09:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"