+ Reply to Thread
Results 1 to 2 of 2

How to get GroupShape.Name ( In case 2 or more Group have identical children shapes)

  1. #1
    Registered User
    Join Date
    06-17-2020
    Location
    japan
    MS-Off Ver
    2019
    Posts
    1

    Question How to get GroupShape.Name ( In case 2 or more Group have identical children shapes)

    ' What code does: I have the following code
    ' When I click the shape of the group shape, I can get "ParentGroup.Name"

    ' Problem:
    If two group shapes have different children shapes, the macro gives the expected result that I want, but if children's names are completely identical, the result is the name of the source shape, but it is not that I had clicked.

    ' Example: Gruop_1 has four child shapes, and the child shape names are Shape_1, Shape_2, shape_3, and Shape_4.
    Gruop_2 also has the same four child shapes, the child shape names are Shape_1, Shape_2, shape_3, and Shape_4.
    When I click Gruop_1, the MsgBox result will be Group_1, but When I click Group_2, the result will also be Gruop_1.

    I copied the group shape and only changed the name for the group, the names of the children in that group remained the same.
    Is that may be why macros don't work as expected?

    What I want to do: How do I get Gruop_2 when I click Gruop_2?
    One more Question:
    I am holding down the Ctrl key and dragging the left mouse button to copy the shape. are there any changes in the two shapes ❓(Example: shape.ID, shape.Name, etc)


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by 6StringJazzer; 06-18-2020 at 10:38 AM. Reason: fixed typo in title

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: How to get GroupShape.Name ( In case 2 or more Group have identical children shapes)

    Hi and welcome to ExcelForum,

    I copied the group shape and only changed the name for the group, the names of the children in that group remained the same.
    Is that may be why macros don't work as expected?
    Each shape name should be Unique (e.g. 'G3 Switch P4_1')

    Application.Caller identifies the name of the Shape that was selected.
    When using the name to get a Shape Object, the first name in the list that matches the name is used. The first Shape with the given name will always be the Shape that VBA refers to, including the Group that shape belongs to.

    ----------------------
    I am holding down the Ctrl key and dragging the left mouse button to copy the shape. are there any changes in the two shapes ❓(Example: shape.ID, shape.Name, etc)
    No. As far as I know, you have an exact clone, which is the problem. You need different names.

    Lewis

+ 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. [SOLVED] Using SELECT CASE with Shapes
    By Logit in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-07-2020, 06:01 PM
  2. [SOLVED] Identical Formulas from Identical Data Sets Return Different Results
    By EverClever in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-28-2018, 06:56 PM
  3. Merge rows in case value in column is identical - without data loss
    By ali0179 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-07-2016, 11:01 AM
  4. Replies: 17
    Last Post: 05-20-2011, 01:48 AM
  5. Vlookup for case with identical lookup values?
    By lopata in forum Excel General
    Replies: 2
    Last Post: 05-10-2011, 08:46 AM
  6. How To Move Shapes From Another Shapes? (floating shapes)
    By MarcLev in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2009, 04:04 PM
  7. Replies: 0
    Last Post: 01-05-2005, 08:06 AM

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