top of page

VB-Net Excel 圖片增加以及簡易設定

作家相片: MoonNightMoonNight

'開啟

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


© 2019 by The Book Lover. Proudly created with Wix.com

  • Pinterest的 - 白圈
bottom of page