How to insert an embedded picture?

后端 未结 3 1602
忘了有多久
忘了有多久 2020-11-27 21:15

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

相关标签:
3条回答
  • 2020-11-27 21:43
    Activesheet.Shapes.AddPicture Filename:="C:\image.jpg", LinkToFile:=msoFalse, _
            SaveWithDocument:=msoTrue, Left:=0, Top:=0, Width:=-1, Height:=-1
    

    this works, maybe the following code can help someone too (it helped me) this is how you select the image you've just added:

    ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Select
    
    0 讨论(0)
  • 2020-11-27 21:45

    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
    
    0 讨论(0)
  • 2020-11-27 21:50

    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.)

    0 讨论(0)
提交回复
热议问题