0

I have an .xlsm file with an ActiveX Microsoft Web Browser control ("Shell.Explorer.2"). I use VBA to open an image inside of it:

WebBrowser.Navigate Application.ActiveWorkbook.Path & "\image.gif"

I know that if I put an image on the worksheet it will be saved inside the .xlsm file. Such images are stored in the .xlsm (which is of ZIP structure) at \xl\media\ 'folder'.

Now I'd like to move the image from the workbook's path into the .xlsm file itself. How can I then address this image from the WebBrowser control? Should I navigate to a file inside of .xlsm as to resource or could I refer to a shape holding the image?

I know about solution based on copying (or exporting) the image from the shape and creating a dynamic HTML to include this newly copied image. I'd still like to find a way without copying/exporting it.

Thanks!

hypers
  • 1,045
  • 1
  • 12
  • 30
  • 1
    Store the image as a base64 string and use a data uri in an image tag to display it via an update to the DOM. – Alex K. Oct 18 '16 at 11:03
  • Thanks, @AlexK. Though your suggestion doesn't answer my initial question about accessibility of internally stored images, it's still an answer. I actually tried it and it seems to be a perfectly valid solution. I was surprised that this method allowed to load large images (mine was about 40K and I had to split it into two cells) as I heard there was some 2K limit for data uri. So why not leave it as an answer for I (and hopefuly others) could vote it up? – hypers Oct 18 '16 at 19:52

0 Answers0