+ Reply to Thread
Results 1 to 9 of 9

Loop through OLEobject images on worksheet

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    10

    Loop through OLEobject images on worksheet

    Hello all,

    I have 8 OLEobject image holders on a worksheet and want to loop through them so that I can add images to them in turn as the images will change based on the other code I am using. But I want to reference their name as a variable so that if I change the amount of them (image objects) in the future I just increase the size of the loop to account for the increase.

    I've tried this but keep getting error messages
    Please Login or Register  to view this content.
    Any help much appreciated.

    Chimpy

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Loop through OLEobject images on worksheet

    maybe post the whole code instead of one line out of context? ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    04-25-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Loop through OLEobject images on worksheet

    Here is part of some I tried but i'm not that hot at VBA and have to relearn it everytime I use as I use it so infrequently. Old age unfortunately, and a memory like a fish
    Please Login or Register  to view this content.
    Thanks

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Loop through OLEobject images on worksheet

    not real clear to me what you're trying to do there-there's no loop and I can't see how anything in that code would vary within a loop?

  5. #5
    Registered User
    Join Date
    04-25-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Loop through OLEobject images on worksheet

    Does this make more sense?

    Please Login or Register  to view this content.
    Cheers

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Loop through OLEobject images on worksheet

    maybe :-)
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-25-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Loop through OLEobject images on worksheet

    Thanks for the reply mate, unfortunately i'm getting the following error message:

    'Unable to get the OLEObject property of the Worksheet class'

    on this line
    Please Login or Register  to view this content.
    Does that mean it can't find the image object?

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Loop through OLEobject images on worksheet

    yes-are you sure the name starts with a period?

    I just realized your variable is declared as oleobject so it oughta be
    Please Login or Register  to view this content.
    after changing the name as appropriate

  9. #9
    Registered User
    Join Date
    04-25-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Loop through OLEobject images on worksheet

    Huzzah! you're right chap, it doesn't have the period in front of "img", all sorted now. Thanks very much for the help I was pulling my grey hair out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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