+ Reply to Thread
Results 1 to 6 of 6

Reference an inserted picture by location without looping

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Reference an inserted picture by location without looping

    Hi all,

    Anyone know if i can make reference to an inserted picture by its location without performing a loop through all shapes first and not knowing the pictures name specifically?

    Currently I'm using:


    Please Login or Register  to view this content.
    Any help is appreciated.

    Thanks,

    BDB
    Last edited by bdb1974; 07-24-2012 at 12:20 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Reference an inserted picture by location without looping

    Hello BDB,

    Without a name, you can not locate the object without looping. The worksheet is the parent object that contains the picture and sets the left, top, height, and width properties when it is added to the worksheet but the worksheet does create a collection of the picture objects by their location, only by name.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

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

    Re: Reference an inserted picture by location without looping

    As Leith says there is a picture collection you can loop through. You can also use the TopLeftCell property to determine whether the picture is located near the area.

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

  4. #4
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Reference an inserted picture by location without looping

    Looping through just the pictures appears to be a better solution than looping through all the sheets objects.
    I do have a couple issues/concerns remaining. First, how do I reference or select the obj pic for deletion?
    I have tried the following statements and none work.
    Please Login or Register  to view this content.
    Second may not be an issue/concern using the Intersect method, but previously I had situation where a picture I would attemp to remove would slightly be overlapping another cell. So testing whether the selected cell top matched the picture top would fail. Can this be the case for
    using the interest method too?


    Please Login or Register  to view this content.
    Any feedback is welcome.

    Thanks guys.

    BDB

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

    Re: Reference an inserted picture by location without looping

    Please Login or Register  to view this content.
    If your pictures are not positioned correctly then you will need to come up with a more broader criteria and test that. The picture has a topleftcell and a bottomrightcell whic you can use, including resizing that range to extend outwards.

  6. #6
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Reference an inserted picture by location without looping

    Thanks Andy for responding back.
    I don't think this picture position is going to be an issue after all.
    I managed to delete the picture by dimming the objPic as Object (which I had initially did not do), objPic.select, objPic.cut

    However the last code you posted looks interesting. I may use it if I come across any other issues that have not yet been present.

    I believe this pretty much resolves my problems. Therefore, I'm closing this thread.

    Thanks again Andy for you help.


    Regards,

    BDB

+ 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