How do I insert a WebP-image (".jpg") in Excel using VBA?

1k views Asked by At

As the the title suggests, I am dealing with a WebP image online. The file name ends in .jpg, but it's a WebP image.

I would like to insert this image in an excel sheet using "ActiveSheet.Pictures.Insert". My code works well for actual .jpg images, but it doesn't work for this image. I can only suspect it's because it's a WebP image (I got error code 1004: "Unable to get the Insert property of the Pictures class").

Is there anyway in Excel/VBA to deal with WebP images? I've tried to look into FreeImage but I am not familiar with any of this. If I understand I can use FreeImage as a plug-in which allows me to convert an image? I downloaded the .zip-file with the program and the documentation, but I did not really feel like I had the knowledge to adequately use it.

Thanks for your attention!

1

There are 1 answers

2
HackSlash On

As of today, you don't.

It's not currently on the list of supported types:

https://learn.microsoft.com/en-us/deployoffice/compat/office-file-format-reference

I recommend you convert the image to JPG or BMP format before you insert the image.