Il m'arrive le problème suivant: Je n'arrives pas à créer des boutons avec
texte sur la toolbar Excel (pas des menus)...En fait, je voudrais mettre des
boutons Excel, mais sur la toolbar...
Si quelqu'un pourrais me fournir gentillement un morceau de code, ce serait
sympa..
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
papou
Bonjour Voici un exemple vite fait ;-) Cordialement Pascal
Sub Auto_Open() Dim MaBo As CommandBar On Error Resume Next Set MaBo = Application.CommandBars("BoRaphael") On Error GoTo 0 If MaBo Is Nothing Then Set MaBo = Application.CommandBars.Add(Name:="BoRaphael") End If Dim monBouton As CommandBarButton Set monBouton = MaBo.Controls.Add(msoControlButton, , , , True) With monBouton .Style = msoButtonCaption .Caption = "Mon Bouton" .OnAction = "Macro_Raphael" End With MaBo.Enabled = True MaBo.Visible = True End Sub Sub Auto_Close() On Error Resume Next Application.CommandBars("BoRaphael").Visible = False End Sub Sub Macro_Raphael() MsgBox "Macro_Raphael qui roule" End Sub
"Raphaël Désalbres" a écrit dans le message de news: %
Bonjour à tous et à toutes,
Il m'arrive le problème suivant: Je n'arrives pas à créer des boutons avec texte sur la toolbar Excel (pas des menus)...En fait, je voudrais mettre des boutons Excel, mais sur la toolbar...
Si quelqu'un pourrais me fournir gentillement un morceau de code, ce serait sympa..
A+,
Raphaël....
Bonjour
Voici un exemple vite fait ;-)
Cordialement
Pascal
Sub Auto_Open()
Dim MaBo As CommandBar
On Error Resume Next
Set MaBo = Application.CommandBars("BoRaphael")
On Error GoTo 0
If MaBo Is Nothing Then
Set MaBo = Application.CommandBars.Add(Name:="BoRaphael")
End If
Dim monBouton As CommandBarButton
Set monBouton = MaBo.Controls.Add(msoControlButton, , , , True)
With monBouton
.Style = msoButtonCaption
.Caption = "Mon Bouton"
.OnAction = "Macro_Raphael"
End With
MaBo.Enabled = True
MaBo.Visible = True
End Sub
Sub Auto_Close()
On Error Resume Next
Application.CommandBars("BoRaphael").Visible = False
End Sub
Sub Macro_Raphael()
MsgBox "Macro_Raphael qui roule"
End Sub
"Raphaël Désalbres" <raphael@desalbres.com> a écrit dans le message de news:
%23NRnC7oEFHA.1524@TK2MSFTNGP09.phx.gbl...
Bonjour à tous et à toutes,
Il m'arrive le problème suivant: Je n'arrives pas à créer des boutons avec
texte sur la toolbar Excel (pas des menus)...En fait, je voudrais mettre
des boutons Excel, mais sur la toolbar...
Si quelqu'un pourrais me fournir gentillement un morceau de code, ce
serait sympa..
Bonjour Voici un exemple vite fait ;-) Cordialement Pascal
Sub Auto_Open() Dim MaBo As CommandBar On Error Resume Next Set MaBo = Application.CommandBars("BoRaphael") On Error GoTo 0 If MaBo Is Nothing Then Set MaBo = Application.CommandBars.Add(Name:="BoRaphael") End If Dim monBouton As CommandBarButton Set monBouton = MaBo.Controls.Add(msoControlButton, , , , True) With monBouton .Style = msoButtonCaption .Caption = "Mon Bouton" .OnAction = "Macro_Raphael" End With MaBo.Enabled = True MaBo.Visible = True End Sub Sub Auto_Close() On Error Resume Next Application.CommandBars("BoRaphael").Visible = False End Sub Sub Macro_Raphael() MsgBox "Macro_Raphael qui roule" End Sub
"Raphaël Désalbres" a écrit dans le message de news: %
Bonjour à tous et à toutes,
Il m'arrive le problème suivant: Je n'arrives pas à créer des boutons avec texte sur la toolbar Excel (pas des menus)...En fait, je voudrais mettre des boutons Excel, mais sur la toolbar...
Si quelqu'un pourrais me fournir gentillement un morceau de code, ce serait sympa..
A+,
Raphaël....
Raphaël Désalbres
Merci beaucoup papou...Ta solution convient parfaitement...
Cordialement,
Raphaël Désalbres
"papou" <cestpasbon@çanonplus44.fr> escreveu na mensagem news:
Bonjour Voici un exemple vite fait ;-) Cordialement Pascal
Sub Auto_Open() Dim MaBo As CommandBar On Error Resume Next Set MaBo = Application.CommandBars("BoRaphael") On Error GoTo 0 If MaBo Is Nothing Then Set MaBo = Application.CommandBars.Add(Name:="BoRaphael") End If Dim monBouton As CommandBarButton Set monBouton = MaBo.Controls.Add(msoControlButton, , , , True) With monBouton .Style = msoButtonCaption .Caption = "Mon Bouton" .OnAction = "Macro_Raphael" End With MaBo.Enabled = True MaBo.Visible = True End Sub Sub Auto_Close() On Error Resume Next Application.CommandBars("BoRaphael").Visible = False End Sub Sub Macro_Raphael() MsgBox "Macro_Raphael qui roule" End Sub
"Raphaël Désalbres" a écrit dans le message de news: %
Bonjour à tous et à toutes,
Il m'arrive le problème suivant: Je n'arrives pas à créer des boutons avec texte sur la toolbar Excel (pas des menus)...En fait, je voudrais mettre des boutons Excel, mais sur la toolbar...
Si quelqu'un pourrais me fournir gentillement un morceau de code, ce serait sympa..
A+,
Raphaël....
Merci beaucoup papou...Ta solution convient parfaitement...
Cordialement,
Raphaël Désalbres
"papou" <cestpasbon@çanonplus44.fr> escreveu na mensagem
news:uwVwNWrEFHA.2032@tk2msftngp13.phx.gbl...
Bonjour
Voici un exemple vite fait ;-)
Cordialement
Pascal
Sub Auto_Open()
Dim MaBo As CommandBar
On Error Resume Next
Set MaBo = Application.CommandBars("BoRaphael")
On Error GoTo 0
If MaBo Is Nothing Then
Set MaBo = Application.CommandBars.Add(Name:="BoRaphael")
End If
Dim monBouton As CommandBarButton
Set monBouton = MaBo.Controls.Add(msoControlButton, , , , True)
With monBouton
.Style = msoButtonCaption
.Caption = "Mon Bouton"
.OnAction = "Macro_Raphael"
End With
MaBo.Enabled = True
MaBo.Visible = True
End Sub
Sub Auto_Close()
On Error Resume Next
Application.CommandBars("BoRaphael").Visible = False
End Sub
Sub Macro_Raphael()
MsgBox "Macro_Raphael qui roule"
End Sub
"Raphaël Désalbres" <raphael@desalbres.com> a écrit dans le message de
news: %23NRnC7oEFHA.1524@TK2MSFTNGP09.phx.gbl...
Bonjour à tous et à toutes,
Il m'arrive le problème suivant: Je n'arrives pas à créer des boutons
avec texte sur la toolbar Excel (pas des menus)...En fait, je voudrais
mettre des boutons Excel, mais sur la toolbar...
Si quelqu'un pourrais me fournir gentillement un morceau de code, ce
serait sympa..
Merci beaucoup papou...Ta solution convient parfaitement...
Cordialement,
Raphaël Désalbres
"papou" <cestpasbon@çanonplus44.fr> escreveu na mensagem news:
Bonjour Voici un exemple vite fait ;-) Cordialement Pascal
Sub Auto_Open() Dim MaBo As CommandBar On Error Resume Next Set MaBo = Application.CommandBars("BoRaphael") On Error GoTo 0 If MaBo Is Nothing Then Set MaBo = Application.CommandBars.Add(Name:="BoRaphael") End If Dim monBouton As CommandBarButton Set monBouton = MaBo.Controls.Add(msoControlButton, , , , True) With monBouton .Style = msoButtonCaption .Caption = "Mon Bouton" .OnAction = "Macro_Raphael" End With MaBo.Enabled = True MaBo.Visible = True End Sub Sub Auto_Close() On Error Resume Next Application.CommandBars("BoRaphael").Visible = False End Sub Sub Macro_Raphael() MsgBox "Macro_Raphael qui roule" End Sub
"Raphaël Désalbres" a écrit dans le message de news: %
Bonjour à tous et à toutes,
Il m'arrive le problème suivant: Je n'arrives pas à créer des boutons avec texte sur la toolbar Excel (pas des menus)...En fait, je voudrais mettre des boutons Excel, mais sur la toolbar...
Si quelqu'un pourrais me fournir gentillement un morceau de code, ce serait sympa..