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
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
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
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
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
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
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
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