+ Reply to Thread
Results 1 to 7 of 7

checking if shapes exist and grouping them

  1. #1
    Registered User
    Join Date
    06-16-2008
    Posts
    32

    checking if shapes exist and grouping them

    I've a small problem.

    I'm creating a powerpoint presentation based on a data in excel.

    The presentation consists of dozens of rounded rectangles with text in them, and depending on data, they may get a star, circle or other kind of things on top of them (small pictures).

    I would somehow be able to group these shapes...

    So far I'm creating the shapes(4 different shapes for now):

    the 'main' rounded rectangle is named 'boxframe' & indexnr

    star is named star & indernr (the indexnr is always same as in the box, so if there's a box with index 12, and it has data in it which qualifies a star on it, the star will be named star12.

    and few more objects, similarly named.

    I've counted how many boxforms there is on the sheet and made a loop through all of them, but then there's the problem. I've no idea how to check if the star @ that indexnr exists... if I knew I could just:
    Please Login or Register  to view this content.
    Note that the code in the tags is not real, it would give gazillion errors, but it's approx how i'm planning. Just, I've no idea how to check if a shape exists.

    Thanks.

    ps. this is not strictly an excel problem, but vba :P

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430
    You need to write a function to test for shape.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    06-16-2008
    Posts
    32
    Couldn't get it work :I

    here's how I tried it now:

    Please Login or Register  to view this content.
    so... basically it should just jump over the adding to array and such if an error appears... It just doesn't work :P

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

    The code will group those rectangle and stars that match.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-16-2008
    Posts
    32
    Nevermind, solved :P

    here's the code

    Please Login or Register  to view this content.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430
    If all items are required in order to group them then you can condense you code to

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-16-2008
    Posts
    32
    Quote Originally Posted by Andy Pope View Post
    If all items are required in order to group them then you can condense you code to

    Please Login or Register  to view this content.
    Thank you, though not all are required. Just need to have 2 elements for grouping.

    The meaning of this grouping is that if user has to modify the presentation by hand a bit, it's easier to move the groups of objects which belong together, than all objects separately.

    So if there's no extra objects at all, I skip the grouping all together ( There is always the 'boxframe' That's where all are 'attached')

    I'm sure there's million better ways to code this than mine and I'm always writing quite bloated code. But no-one else is reading this but me

    Thanks anyway.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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