OVH Cloud OVH Cloud

Barre d'outils personnalisée

2 réponses
Avatar
Tial
Bonjour à toutes et tous.

Avec le code ci dessous, je creer une barre d'outils personnalisée.
Pourquoi quand j'ajoute:
.Controls.Add Type:=msoControlButton, Id:=128, Before:=1
Je n'arrive pas à avoir le bouton "annuler" en plus.
Par avance merci de votre aide.
Tial

.CommandBars.Add(Name:="Forme libre").Visible = True
With .CommandBars("Forme libre")
.Position = msoBarRight
.Controls.Add Type:=msoControlButton, Id:=21, Before:=1
.Controls.Add Type:=msoControlButton, Id:=22, Before:=2
.Controls.Add Type:=msoControlButton, Id:=206, Before:=1
.Controls.Add Type:=msoControlButton, Id:=200, Before:=1

2 réponses

Avatar
Tial
Je joint l'ensemble de mon code, au cas ou.
Tial


Sub CreateBO()
'Création de la barre d'outils "Forme Libre"
Citron = "Dégivré"
On Error GoTo fin
With Application
.ScreenUpdating = False
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
.CommandBars.Add(Name:="Forme libre").Visible = True
With .CommandBars("Forme libre")
.Position = msoBarRight
.Controls.Add Type:=msoControlButton, Id:!, Before:=1
.Controls.Add Type:=msoControlButton, Id:", Before:=2
.Controls.Add Type:=msoControlButton, Id: 6, Before:=1
.Controls.Add Type:=msoControlButton, Id: 0, Before:=1
.Controls.Add Type:=msoControlButton, Id:8, Before:=1
With .Controls.Add(msoControlButton)
.OnAction = "Feuille2"
.FaceId = 916
.Caption = "Afficher la feuille de traitement"
End With
With .Controls.Add(msoControlButton)
.OnAction = "Feuille1"
.FaceId = 956
.Caption = "Afficher la feuille de rapport"
End With
With .Controls.Add(msoControlButton)
.OnAction = "Feuille3"
.FaceId = 984
.Caption = "Afficher la feuille d'aide"
End With
With .Controls.Add(msoControlButton)
.OnAction = "LoupeGivre"
.FaceId = 25
.Caption = "Zoomer l'image"
End With
With .Controls.Add(msoControlButton)
.OnAction = "AfficherVignette"
.FaceId = 623
.Caption = "Afficher Vignette"
End With
With .Controls.Add(msoControlButton)
.OnAction = "Imprimer"
.FaceId = 4
.Caption = "Imprimer le Rapport"
End With
With .Controls.Add(msoControlButton)
.OnAction = "copiefeuille"
.FaceId = 317
.Caption = "Transfert du rapport"
End With

With .Controls.Add(msoControlButton)
.OnAction = "Fermer"
.FaceId = 51
.Caption = "Quitter l'application"
End With


End With

End With


ActiveSheet.Shapes.AddShape(msoShapeRectangle, 1, 1, 1, 1). _
Select
With Selection.ShapeRange
.Fill.Visible = msoFalse
.Line.Weight = 0.5
.Line.ForeColor.SchemeColor = 48
.SetShapesDefaultProperties
End With
Selection.Delete
fin:
End Sub
Avatar
anonymousA
bonjour

.Controls.Add Type:=msoControlSplitDropdown, ID:8, Before:=1

au lieu de

.Controls.Add Type:=msoControlButton, Id:8, Before:=1

A+

Je joint l'ensemble de mon code, au cas ou.
Tial


Sub CreateBO()
'Création de la barre d'outils "Forme Libre"
Citron = "Dégivré"
On Error GoTo fin
With Application
.ScreenUpdating = False
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
.CommandBars.Add(Name:="Forme libre").Visible = True
With .CommandBars("Forme libre")
.Position = msoBarRight
.Controls.Add Type:=msoControlButton, Id:!, Before:=1
.Controls.Add Type:=msoControlButton, Id:", Before:=2
.Controls.Add Type:=msoControlButton, Id: 6, Before:=1
.Controls.Add Type:=msoControlButton, Id: 0, Before:=1
.Controls.Add Type:=msoControlButton, Id:8, Before:=1
With .Controls.Add(msoControlButton)
.OnAction = "Feuille2"
.FaceId = 916
.Caption = "Afficher la feuille de traitement"
End With
With .Controls.Add(msoControlButton)
.OnAction = "Feuille1"
.FaceId = 956
.Caption = "Afficher la feuille de rapport"
End With
With .Controls.Add(msoControlButton)
.OnAction = "Feuille3"
.FaceId = 984
.Caption = "Afficher la feuille d'aide"
End With
With .Controls.Add(msoControlButton)
.OnAction = "LoupeGivre"
.FaceId = 25
.Caption = "Zoomer l'image"
End With
With .Controls.Add(msoControlButton)
.OnAction = "AfficherVignette"
.FaceId = 623
.Caption = "Afficher Vignette"
End With
With .Controls.Add(msoControlButton)
.OnAction = "Imprimer"
.FaceId = 4
.Caption = "Imprimer le Rapport"
End With
With .Controls.Add(msoControlButton)
.OnAction = "copiefeuille"
.FaceId = 317
.Caption = "Transfert du rapport"
End With

With .Controls.Add(msoControlButton)
.OnAction = "Fermer"
.FaceId = 51
.Caption = "Quitter l'application"
End With


End With

End With


ActiveSheet.Shapes.AddShape(msoShapeRectangle, 1, 1, 1, 1). _
Select
With Selection.ShapeRange
.Fill.Visible = msoFalse
.Line.Weight = 0.5
.Line.ForeColor.SchemeColor = 48
.SetShapesDefaultProperties
End With
Selection.Delete
fin:
End Sub