要列印EXCEL需要寫的程式碼還蠻簡單的
首先要加入EXCEL的參考 讓 VB看得懂EXCEL
專案>加入參考> 擴充功能>然後照下圖這樣選。
Imports Microsoft.Office.Interop Public Class Receipt Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim x1 As New Excel.Application x1.Workbooks.Open(My.Computer.FileSystem.SpecialDirectories.Desktop & "\test1.xls") '測試用excel檔 x1.ActiveWorkbook.PrintOutEx() x1.Quit() x1 = Nothing End Sub End Class