'開啟
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
'Start a new workbook in Excel
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Open("XLS絕對路徑")
'Add headers to the worksheet on row 1
oSheet = oBook.Worksheets(1)
Try
With oSheet.Pictures.Insert("圖片位置/絕對路徑")
With .ShapeRange
.Width = 30 '圖片寬度
.Height = 45 '圖片高度
End With
.Left = oSheet.Cells(row, col).Left
.Top = oSheet.Cells(row, col).Top + 3 '起始位置 可用+-做調整
.Placement = 1
.PrintObject = True
End With
Catch ex As Exception
End Try
Comments