+ Reply to Thread
Results 1 to 4 of 4

Store images in Excel

  1. #1
    Registered User
    Join Date
    01-07-2011
    Location
    Piacenza, Italy
    MS-Off Ver
    Excel 2010
    Posts
    24

    Store images in Excel

    I am using excel 2010 and I need to store images in an excel file (I mean, really store and not to have a link to an image".

    Suppose I have an image in "C:\img.jpg".
    I insert the image thru the menu (Insert/Image) and then close the excel file and delete the image. If I reopen the excel file I can see the image in it. This means the image is stored in it.

    Since I want to execute this process I have recorded the macro getting the following code:

    Please Login or Register  to view this content.
    If I execute the above code and then save the excel file and delete the image, when I reopen the excel file instead of seeing the image I get an error message saying that the link to the image is wrong. It clear that in this case the image has not been stored but just the link to it.

    Any idea about the way to store images using vba?

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Store images in Excel

    It seems to be a bug in 2010. I suggest you use Shapes.AddPicture instead as that allows you to specify whether you want to link to the file or embed it.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    01-07-2011
    Location
    Piacenza, Italy
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Store images in Excel

    Thank you for your answer. Your solution works. However I have to pass as parameters the size in pixel of the image and I do not have this information. How can I do?

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Store images in Excel

    You don't actually - you pass the size you want the shape on the sheet to be.

+ 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