+ Reply to Thread
Results 1 to 5 of 5

How to refer to a shape which is grouped within another shape

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    How to refer to a shape which is grouped within another shape

    The following code was suggested by Andy Pope and it works making the needle of a meter point to pos, and putting the value into a textbox which is also part of the meter.
    Please Login or Register  to view this content.
    What Andy did not know was that I had made the first part of my code work by ungrouping ShapeName (the needle) from the Meter Group that it had been part of.
    As essentially the same meter will be used 4 times in my project it would be much better to be able to leave the meter group intact and refer to the needle group in code. I have tried using the GroupItems property like
    Please Login or Register  to view this content.
    But the code does not recognize the names. Am I on a hiding to nothing or can this be done?
    John

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,435

    Re: How to refer to a shape which is grouped within another shape

    can you post an example so we can see how the shapes have been grouped?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: How to refer to a shape which is grouped within another shape

    Andy here is the meter divided into 2 groups
    Attached Files Attached Files

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,435

    Re: How to refer to a shape which is grouped within another shape

    This will update the needle and text.

    Please Login or Register  to view this content.
    It also lists the shape type and name of those in the group items collection.

    If you press F10 on the worksheet you should get the Selection pane displayed which will show you the names of shapes and the group hierarchy.
    The problem is that VBA object does not reflect this. Every is grouped at one layer deep even when there are groups within groups.

  5. #5
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: How to refer to a shape which is grouped within another shape

    Andy many thanks for your help. There are parts which I don't understand like .TextFrame2.TextRange.Text, but I hope that I will find answers in the Object Browser.
    John

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Place a grouped chart + Shape into a userform imagebox using VBA
    By demarc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2016, 03:44 AM
  2. Shape buttons - Switch background image of shape on click and exit - referenced jpg
    By ApatheticAndrew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2015, 08:06 AM
  3. Assign macro with parameter to shape based on shape location
    By bobo3127 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2014, 11:18 AM
  4. Replies: 13
    Last Post: 12-10-2013, 12:51 PM
  5. [SOLVED] Use a button to control a macro that inserts an image into a shape or resets the shape
    By nwb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2013, 04:41 PM
  6. [SOLVED] Rotating a grouped shape using excel vba
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-17-2013, 09:31 AM
  7. Replies: 0
    Last Post: 11-30-2012, 01:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1