Record macros with shapes
Record macros with shapes
(OP)
I would like to record macros with shapes.
When I done the shapes (eg. Two circles to form a transformer symbol), then group them as finish.
Next time I want to get the transformer symbol in group, just pick the dedicated macro up.
But, the work isn't so smooth expectedly.
The said macro can't run completely when I repeat to run macro.
Something wrongs in it that I can't fix by myself.
Please refer to the attached and give me a hand.
Thanks in advance.
When I done the shapes (eg. Two circles to form a transformer symbol), then group them as finish.
Next time I want to get the transformer symbol in group, just pick the dedicated macro up.
But, the work isn't so smooth expectedly.
The said macro can't run completely when I repeat to run macro.
Something wrongs in it that I can't fix by myself.
Please refer to the attached and give me a hand.
Thanks in advance.





RE: Record macros with shapes
ActiveSheet.Shapes.AddShape(msoShapeOval, 174, 85.5, 60, 57).Select
Selection.ShapeRange.ShapeStyle = msoShapeStylePreset7
Selection.ShapeRange.Name = "NewOval1"
ActiveSheet.Shapes.AddShape(msoShapeOval, 174.75, 106.5, 60.75, 64.5).Select
Selection.ShapeRange.ShapeStyle = msoShapeStylePreset7
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Name = "NewOval2"
ActiveSheet.Shapes.Range(Array("NewOval1", "NewOval2")).Select
Selection.ShapeRange.Group.Select
This code only allows one copy of the new shape, and it will always be created in the same place on the sheet, but it may be enough to get you started.
Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/
RE: Record macros with shapes
Thanks for your valuable reply.
Now, the macro running is smooth and correct.
Best regards,
CIY
RE: Record macros with shapes
Your recommendation is enough to me.
However, I wonder how to create new shape without limitation of only copy.
Your advice shall be appreciated.
Thanks again.
CIY
RE: Record macros with shapes
ActiveSheet.Shapes.AddShape _
(msoShapeOval, 174 + 10 * i, 85.5, 60, 57).Select
Selection.ShapeRange.Name = "NewOval" & "(" & i & ")"
Selection.ShapeRange.ShapeStyle = msoShapeStylePreset7
Next i
Only put off until tomorrow what you are willing to die having left undone. - Pablo Picasso
RE: Record macros with shapes
Thanks for your advice!
CIY
RE: Record macros with shapes
Only put off until tomorrow what you are willing to die having left undone. - Pablo Picasso