Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 564
  • Last Modified:

Working with shapes



Using a VBA I have placed a rectangle on the worksheet and then placed a number of textboxes on top of the rectangle.

Is there a way when the user selects a shape, that by holding the left mouse button down and dragging the shape the associated textboxes will move with the shape to the new location.

/Bob
0
BobR
Asked:
BobR
  • 7
  • 2
  • 2
  • +1
1 Solution
 
criCommented:
Group them
0
 
criCommented:
Here the macro (record):
..
..
   ActiveSheet.Shapes.Range(Array("Rectangle 1", "Text Box 2", "Text Box 3")). _
        Select
    Selection.ShapeRange.Group.Select
..
..
 
0
 
criCommented:
BTW: Make sure you use connectors if you have lines between the shapes as in a flow/process diagram. Contrary to Word 97, the shapes have this property in Excel and Powerpoint 97
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
criCommented:
And ?
0
 
joanneL2Commented:
Yes.  Make sure your DRAWING toolbar is still turned on (it probably is since you're using shapes) and use the arrow on the drawing toolbar to select your textboxes.  You can use the shift key to select more than one text box and then go back to the drawing toolbar, click on DRAW, align and distribute and you can align them the way you like.  You can also right-click on the boxes and group them (which makes it easier to move them together).    You can also use the right mouse button to get into properties where there's lots of ways to finesse your text boxes.  Of course, you can also turn off the lined border with the line tool, change colors or borders, thickness, etc. Hope this helps.
0
 
criCommented:
joanneL2, as you are new here: We do not post as answer unless we are sure it is what the asking person wants/needs. By posting as answer you withdraw it from the attention of other experts. Therefore the unwriten rule is that questions that are not simple "how-to" are answered upon invitation.

And: We do not rehash previous comments:

My comment was to group them and I gave the instruction how to do this in VBA. So please demote your posting to a comment.  
0
 
calacucciaCommented:
Supporting Cri........

I mean, that is no way of handling things, joannetL2. Imagine you had seen a question, provided three useful, correct, and probably perfect comments, and then someone else jumps in, and repeats part of what you have said, and posts as an answer.

Basically, that's all there is as a problem here, your comment is greatly appreciated, but please stay away from the answer button in the future unless really defendable or unevitable.

Cheers

Calacuccia
0
 
joanneL2Commented:
You're absolutely right.  I AM new here and because I am, I did not know that clicking on "answer" meant that it locked the question.  I thought it was a simple choice of whether your response was more of an answer or more of a comment.  Forgive me.
0
 
calacucciaCommented:
No Problem, JoanneL2, We knew you are new, and that's why we gently show you the way.

Besides, I was so rude not welcoming you. So,...Welcome Joanne

Calacuccia
0
 
BobRAuthor Commented:

The macro:
ActiveSheet.Shapes.Range(Array("Rectangle 1", "Text Box 2", "Text Box 3")). _
        Select
    Selection.ShapeRange.Group.Select

this does not appear to work.
I am attempting to place 1 rectangle and 2 textboxes onto the Worksheet based on the users input on another spreadsheet, and so I do not know what the names of the shapes are as they appear to be dynamic.
What I would like to do is group them together when the user selects the rectangle.

I hope this clears things.

And welcome Joanne and thanks for your comments so far.

/Bob
0
 
criCommented:
Worse than dynamically:
http://support.microsoft.com/support/kb/articles/Q160/5/77.asp

Name the shapes right after you create them. Excerpt from:
http://msdn.microsoft.com/library/officedev/office97/web/010.htm#CH010H105

..
..
Each shape is assigned a default name (for example, "Rectangle 3") when you add it to the Shapes collection. To give the shape a more useful, meaningful name, use the Name property. The following example adds a rectangle to myDocument and gives the rectangle the name "Red Square."
myDocument.Shapes.AddShape(msoShapeRectangle,144, 144, 72, 72).Name = "Red Square"
..
..
0
 
BobRAuthor Commented:
Thanks the reference you sent me too answered all my questions.
/Bob
0
 
criCommented:
You are welcome.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 7
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now