VBA embedding image in a worksheet (Vs. linking)

Important Notice


Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • Hi All


    Need your help with the following:


    I have a code that pulls images into excel (in my case - excel 2010)
    From what I gather, in Excel 2010 - the method I used only creates a link to the image.
    Can you please help me with the proper code that will embed the images in the file (and also allow saving them with the file)?


    This is the code I have been using:


    I am looking for something that will work in Excel 2007-2013 the same way.


    BTW, I wanted to declare "thispicture" but didn't know the what to declare it as. Any suggestions?


    TIA

  • Re: VBA embedding image in a worksheet (Vs. linking)


    Use Shapes.AddPicture.


    e.g.

  • Re: VBA embedding image in a worksheet (Vs. linking)


    Quote

    I wanted to declare "thispicture" but didn't know the what to declare it as


    ThisPicture contains a file name so should be declared as a String.

  • Re: VBA embedding image in a worksheet (Vs. linking)


    Quote from Kenneth Hobson;775461

    Use Shapes.AddPicture.


    e.g.


    Kenneth, thanks for the code. I really appreciate your reply but I am still lost. I must admit I was hoping for something a bit more correlating to MY code (sorry for not being clear about that).
    I have no doubt that what you posted "does the job" of embedding a picture, but it is almost a totally different code than mine, and I am not sure how to adopt it to my needs.
    It is imperative that I keep the variables I am using (the way I get the picture name and path, the position and the size, the locked aspect ratio, etc.).
    Anything along those lines will be most helpful.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!