OVH Cloud OVH Cloud

Texte dans un bouton dans une barre d'outils

1 réponse
Avatar
Thierry
Bonjour à tous,

j'ai créer un bouton dans une barre outil et je voudrais ecrire dans ce
bouton, mais je ne parvient pas à trouver comment faire.
Merci de votre aide.

Thierry

Voici le code que j'ai écrit :


Sub CSRestant()

'création de la Barre d'outils
On Error Resume Next
Application.CommandBars("CS").Delete
On Error GoTo 0
With Application.CommandBars.Add("CS", msoBarTop)
.RowIndex = Application.CommandBars("Standard").RowIndex
.Left = Application.CommandBars("Standard").Width
.Visible = True
End With

'création du bouton de protection
Application.CommandBars("CS").Controls.Add (msoControlButton)
Application.CommandBars("CS").Controls(1).Height = 12
Application.CommandBars("CS").Controls(1).Width = 50
Application.CommandBars("CS").Controls(1).Caption = "Mon texte dans le
bouton"

End Sub

1 réponse

Avatar
Thierry
Un petit plus... est-il possible de choisir la couleur du fond du bouton et
la couleur d'écriture ??

Merci a tous.


"Thierry" a écrit dans le message de news:
cuj9iv$p1j$
Bonjour à tous,

j'ai créer un bouton dans une barre outil et je voudrais ecrire dans ce
bouton, mais je ne parvient pas à trouver comment faire.
Merci de votre aide.

Thierry



Sub CSRestant()

'création de la Barre d'outils
On Error Resume Next
Application.CommandBars("CS").Delete
On Error GoTo 0
With Application.CommandBars.Add("CS", msoBarTop)
.RowIndex = Application.CommandBars("Standard").RowIndex
.Left = Application.CommandBars("Standard").Width
.Visible = True
End With

'création du bouton de protection
Application.CommandBars("CS").Controls.Add (msoControlButton)
Application.CommandBars("CS").Controls(1).Height = 12
Application.CommandBars("CS").Controls(1).Width = 50
Application.CommandBars("CS").Controls(1).Caption = "Mon texte dans le
bouton"

End Sub