Add a rectangle : Shapes « Excel « VBA / Excel / Access / Word






Add a rectangle

 
Sub AddRectangle()
    With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 10, 10, 200, 100).TextFrame
        .Characters.Text = "This is a rectangle"
        .HorizontalAlignment = xlHAlignCenter
        .VerticalAlignment = xlVAlignCenter
    End With
End Sub

 








Related examples in the same category

1.Display auto shapes
2.Add a new shape
3.Draw a star
4.Delete all shapes