Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert an embedded picture?

xlApp.activesheet.Pictures.Insert(strImagePath) inserts pictures into a spreadsheet as a linked picture. If I send the spreadsheet out of our network the images fail.

How can I place an image as an embedded image?

I am also calling this method from Access.

like image 867
DasPete Avatar asked Jun 14 '13 14:06

DasPete


People also ask

How do I add a picture to an embedded file?

Insert a picture in Word, PowerPoint, or Excel Click the location in your document where you want to insert a picture. On the Insert tab, click Pictures. Select the option you want to use for inserting pictures.

What does it mean for an image to be embedded?

Definition: Embedding refers to the integration of links, images, videos, gifs and other content into social media posts or other web media. Embedded content appears as part of a post and supplies a visual element that encourages increased click through and engagement.

Can you embed a JPEG file?

It is possible to use the JPEG file format for more than just displaying images, however. File archives can actually be embedded in the JPEG images, providing business users with additional possibilities when it comes to distributing data.


2 Answers

Note that you can set the required Width and Height parameters to -1, which then maintains the height and width of the original image!

Activesheet.Shapes.AddPicture Filename:="C:\image.jpg", LinkToFile:=msoFalse, _
        SaveWithDocument:=msoTrue, Left:=0, Top:=0, Width:=-1, Height:=-1

http://excelmatters.com/2013/11/25/default-picture-size-with-shapes-addpicture/

(Added as another answer to increase visibility as I've struggled with this problem for ages and haven't found this solution documented anywhere else.)

like image 102
Michael Avatar answered Sep 20 '22 00:09

Michael


you can use the shapes.addpicture method

activesheet.Shapes.AddPicture Filename:="C:\test\desert.jpg", linktofile:=msoFalse, _
            savewithdocument:=msoCTrue, Left:=0, Top:=0, Width:=100, Height:=100
like image 32
JosieP Avatar answered Sep 18 '22 00:09

JosieP