placing image in excel cell

This worked fine for me.

VB.NET:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim xlApp As New Excel.Application
        Dim xlBook As Excel.Workbook = xlApp.Workbooks.Open("C:\Temp\Test.xlsx")
        Dim xlSheet As Excel.Worksheet = xlBook.Worksheets("Sheet1")

        Clipboard.SetDataObject(Image.FromFile("C:\Temp\Logo.jpg"))

        xlSheet.Range("E5").Select()
        xlBook.ActiveSheet.PasteSpecial(Format:="Bitmap", Link:=False, DisplayAsIcon:=False)

        xlBook.Save()
        xlApp.Quit()
    End Sub
 
Back
Top