embed image in cell - not the reference to i but the actual image

  • Is it possible to insert the actual image not the link to it? I want to sent the sheet to management so that they can open up the image. but when I send the one with a link the image does not open. So I'd like the actual image there - is this possible? in vba?


    Joe

  • Re: embed image in cell - not the reference to i but the actual image


  • Re: embed image in cell - not the reference to i but the actual image


    What if I have the filename for the image - how to avoid the selection and just use a filename?

  • Re: embed image in cell - not the reference to i but the actual image


  • Re: embed image in cell - not the reference to i but the actual image


    You need to include

    Code
    On Error GoTo ErrNoPhoto


    at the start of the code for the error handler to work.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: embed image in cell - not the reference to i but the actual image


    You should really use Shapes.AddPicture if you want control over whether the picture is linked or embedded: http://excelmatters.com/tag/addpicture/

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: embed image in cell - not the reference to i but the actual image


    Could not convert it to vbs - the best was this so I could not put the size that i want - can you help?

  • Re: embed image in cell - not the reference to i but the actual image


    It would be like this:


    Code
    .Shapes.AddPicture Filename:="C:\ReportGeneration\Capgemini_logo_high_res.jpg", linktofile:=msoFalse, savewithdocument:=msoCTrue, Left:=.Range("A1").Left, Top:=.Range("A1").Top, Width:=50, Height:=50

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: embed image in cell - not the reference to i but the actual image


    Quote from rory;786653

    It would be like this:


    Code
    .Shapes.AddPicture Filename:="C:\ReportGeneration\Capgemini_logo_high_res.jpg", linktofile:=msoFalse, savewithdocument:=msoCTrue, Left:=.Range("A1").Left, Top:=.Range("A1").Top, Width:=50, Height:=50


    what if I need to embed it in this code in place of oEngine.ActiveSheet.Pictures.Insert(fullfilename) - I have tried a few things but keep erroring
    objSheet.Cells(Row, 7).Select

    oEngine.ActiveSheet.Pictures.Insert(fullfilename)
    With objSheet
    .Shapes.AddPicture Filename:="C:\ReportGeneration\Capgemini_logo_high_res.jpg", linktofile:=msoFalse, savewithdocument:=msoCTrue, Left:=.Range("A1").Left, Top:=.Range("A1").Top, Width:=50, Height:=50
    ' .Left = objSheet.Cells(Row, 7).Left '<--- change cell as required
    ' .Top = objSheet.Cells(Row, 7).Top '<--- change cell as required
    ' .ShapeRange.LockAspectRatio = msoFalse
    ' .ShapeRange.Height = 100
    ' .ShapeRange.Width = 100
    ' .ShapeRange.Rotation = 0
    End With

  • Re: embed image in cell - not the reference to i but the actual image


    The code looks correct to me and I can't read anything in that picture you posted. It's a strange looking dialog though.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: embed image in cell - not the reference to i but the actual image


    Hi,


    Is there a way to do something similar using urls from cells in a column (AJ) to download and embed the images in cells in adjacent column (AK) ?
    I'm using Excel 2016 64bits (I think the code might be different due to 64 bit ?)
    I also need to get the images from s3.amazonaws.com so there may be some access requirements too.


    Thanks in advance
    G

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!