im using visualbasic express. I want to insert an image into an excel application. I did it. here is the code:
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
oBook = oExcel.Workbooks.Add
oSheet = oBook.Worksheets(1)
oSheet.Shapes.AddPicture("C:\Logo\logo.bmp", False, True, 415, 1, 20, 30)
It works well. But instead of indicating the location of the image ("C: \ Logo \ logo.bmp"), I want to put the image on my own. I want me to change the last line as follows:
oSheet.Shapes.AddPicture(Me.Picturebox1.image , False, True, 415, 1, 20, 30)
But that will not work. Is there a way to insert an image in excel without using a location?
source
share