Sub essaiCentré()
ecritShapeCentre "orne", "Orne"
ecritShapeCentre "sarthe", "Sarthe"
ecritShapeCentre "triangle", "abcd"
ecritShapeCentre "test", "Coucou"
End Sub
Sub essaiPosition()
ecritShapePosition "orne", "Orne", 15, 4
ecritShapePosition "sarthe", "Sarthe", 13, 4
ecritShapePosition "triangle", "abcd", 20, 20
ecritShapePosition "test", "Coucou", 50, 50
End Sub
Sub ecritShapeCentre(nomShape, Libellé)
With ActiveSheet.Shapes(nomShape).TextFrame2
.TextRange.Characters.Text = Libellé
.TextRange.Characters.Font.Size = 8
.MarginLeft = 0
.MarginTop = 0
.MarginBottom = 0
.MarginRight = 0
.VerticalAnchor = msoAnchorMiddle
.HorizontalAnchor = msoAnchorCenter
End With
ActiveSheet.Shapes(nomShape).OLEFormat.Object.Font.Color = vbBlack
End Sub
Sub ecritShapePosition(nomShape, Libellé, gauche, haut)
With ActiveSheet.Shapes(nomShape).TextFrame2
.TextRange.Characters.Text = Libellé
.TextRange.Characters.Font.Size = 8
.MarginLeft = gauche
.MarginTop = haut
.MarginBottom = 0
.MarginRight = 0
End With
End Sub