Sub essai()
ActiveSheet.Shapes.AddShape(msoShapeOval, 10, 10, 100, 50).Name = "shape1"
ActiveSheet.Shapes.AddShape(msoShapeOval, 10, 70, 100, 50).Name = "shape2"
ecritShape "shape1", "coucou"
ecritShape "shape2", "coucou", "Bas", "Gauche"
End Sub
Sub ecritShape(nomShape, Libellé, Optional posVert, Optional posHoriz)
With ActiveSheet.Shapes(nomShape).TextFrame2.TextRange
.Characters.Text = Libellé
.Characters.Font.Size = 6
If IsMissing(posVert) Then
.Parent.VerticalAnchor = msoAnchorMiddle
Else
If posVert = "Bas" Then
.Parent.VerticalAnchor = msoAnchorBottom
Else
If posVert = "Haut" Then
.Parent.VerticalAnchor = msoAnchorTop
Else
.Parent.VerticalAnchor = msoAnchorMiddle
End If
End If
End If
If IsMissing(posHoriz) Then
.Parent.HorizontalAnchor = msoAnchorCenter
Else
If posHoriz = "Gauche" Then
.Parent.HorizontalAnchor = msoAnchorNone
Else
.Parent.HorizontalAnchor = msoAnchorCenter
End If
End If
End With
End Sub