×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Record macros with shapes
2

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.
 

RE: Record macros with shapes

If you give the shapes a new name after you have created them, you can then select and group them:

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

(OP)
IDS,

   Thanks for your valuable reply.
   Now, the macro running is smooth and correct.

   Best regards,

                   CIY

RE: Record macros with shapes

(OP)
IDS,

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

For i = 1 To 10
  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

(OP)
BigInch,

       Thanks for your advice!

                      CIY

RE: Record macros with shapes

you're welcome.  There may be more elegant ways to do it, but ... that one works.

Only put off until tomorrow what you are willing to die having left undone. - Pablo Picasso

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources