PC Review


Reply
Thread Tools Rate Thread

how to Add a command button to the standard commandbar of the visual editor window

 
 
MichDenis
Guest
Posts: n/a
 
      2nd Oct 2007
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 With Quote
 
 
 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      3rd Oct 2007
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
>
>
>

 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      3rd Oct 2007
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 With Quote
 
MichDenis
Guest
Posts: n/a
 
      3rd Oct 2007
Thanks for your participation.

If you're still interested, 2 addresses :

(near the bottom of the page ...)
http://usenet.p2preactor.com/index-t-1455761.html




http://www.cpearson.com/excel/VbeMenus.aspx





Salutations





"JLGWhiz" <(E-Mail Removed)> a écrit dans le message de news:
D5B4470F-9181-49F0-AA94-(E-Mail Removed)...
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic editor window JoD Microsoft Access VBA Modules 5 6th Mar 2008 03:31 PM
How to Hide Visual Basic Editor (VBE) Window Programmatically charles-guillaume.harika@piaget.com Microsoft Access Form Coding 2 4th Apr 2007 05:41 PM
how to add a custom button on the explorer "standard" commandbar =?Utf-8?B?SGVydmUgY2FkaWV1?= Microsoft Outlook VBA Programming 1 17th Mar 2006 03:33 PM
Add standard button on custum commandbar Jos Vens Microsoft Excel Programming 6 31st Oct 2005 11:04 PM
Immediate Window in Visual Basic Editor VanW Microsoft Access VBA Modules 1 25th Aug 2004 03:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:36 PM.