1.在參考中加入excel COM元件 Microsoft Excel 11.0 object library 或 Microsoft Excel 12.0 object library 如果加入之後 有錯誤 可能是缺少 Office PIA 可以到網路上下載 2.使用code Dim excel As New Microsoft.Office.Interop.Excel.ApplicationClass Dim wBook As Microsoft.Office.Interop.Excel.Workbook Dim wSheet As Microsoft.Office.Interop.Excel.Worksheet wBook = excel.Workbooks.Add() wSheet = wBook.ActiveSheet() /*對內容處理*/ excel.Cells(1, 1) = "123" wSheet.Columns.AutoFit() Dim excelFileName As String = "F:\MyExcel.xls" wBook.SaveAs(excelFileName) wBook.Close() excel.Quit() excel = Nothing