Saturday 15 November 2014

All Rectangle Shapes using VB

Sub AllRectangleShapes()

' ShapeStylePreset can set upto 48 starting with 1 in MS Excel 2010
'Text Effect can set fom 1 upto 24. Somehow depends on Excel version
ActiveSheet.Shapes.AddShape(msoShapeRound1Rectangle, 510, 33.75, 79.5, 95.25).Select

Selection.ShapeRange.ShapeStyle = msoShapeStylePreset1
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect16

Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"

ActiveSheet.Shapes.AddShape(msoShapeRectangle, 141, 14.25, 105, 63).Select
Selection.ShapeRange.ShapeStyle = msoShapeStylePreset2
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect5

Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"

ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangle, 339, 27.75, 99.75, 90).Select

Selection.ShapeRange.ShapeStyle = msoShapeStylePreset3
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect3

Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"

ActiveSheet.Shapes.AddShape(msoShapeSnip1Rectangle, 64.5, 91.5, 95.25, 93).Select

Selection.ShapeRange.ShapeStyle = msoShapeStylePreset4
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect9
Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"


ActiveSheet.Shapes.AddShape(msoShapeSnip2SameRectangle, 243, 123, 83.25, 95.25).Select

Selection.ShapeRange.ShapeStyle = msoShapeStylePreset5
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect11
Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"


ActiveSheet.Shapes.AddShape(msoShapeSnip2DiagRectangle, 390, 147.75, 86.25, 93).Select

Selection.ShapeRange.ShapeStyle = msoShapeStylePreset6
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect17
Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"


ActiveSheet.Shapes.AddShape(msoShapeSnipRoundRectangle, 140.25, 222.75, 92.25, 94.5).Select

Selection.ShapeRange.ShapeStyle = msoShapeStylePreset7
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect24
Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"


ActiveSheet.Shapes.AddShape(msoShapeRound2SameRectangle, 321.75, 259.5, 51.75, 67.5).Select

Selection.ShapeRange.ShapeStyle = msoShapeStylePreset8
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect22
Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"


ActiveSheet.Shapes.AddShape(msoShapeRound2DiagRectangle, 548.25, 184.5, 94.5, 108).Select

Selection.ShapeRange.ShapeStyle = msoShapeStylePreset9
Selection.ShapeRange.TextFrame2.WordArtformat = msoTextEffect21

Selection.ShapeRange.TextFrame2.TextRange.Characters.Text = "Example"

End Sub


No comments:

Post a Comment