I am working on a macro for my friend who needs to import a set of images into an excel document and then use this document on other computers. The problem that I encountered is that when I open this document on another computer, all the images disappear, and instead you get these small error signs, indicating that the path to the image was not found.
I developed a macro on my own computer, where I have Excel 2007, and for me the code works fine. My friend uses Excel 2013 and it seems that there is a big difference in how the two versions relate to import and save images.
In general, I found two different ways to insert images. The first one I tried was something like this:
Set pic = ActiveSheet.Pictures.Insert("C:\documents\somepicture.jpg")
The second way to do this is as follows:
Set pic = Application.ActiveSheet.Shapes.AddPicture("C:\documents\somepicture.jpg", False, True, 1, 1, 1, 1)
The documentation for this second approach says that the 3rd paragraph (which is True here) is responsible for saving the image with the document.
However, both of these approaches look more or less the same in the end result: they work fine for me, but will not work if they run on my friends computer from Excel 2013. So I need to work for new versions of Excel (Iām somewhere read that from Excel 2010 up, there is an error or something similar with these image import methods).
source share