Using dtb As New DataTable dtb = Dt.Clone dtb.Columns.Remove("Name") Dim oExcel As New Excel.Application Dim obook As Excel.Workbook Dim oSheet As Excel.Worksheet Try obook = oExcel.Workbooks.Add '.Open(file) oSheet = obook.Worksheets(1) oSheet.Name = SheetName Dim r As Integer, c As Integer Dim rCount As Integer Dim cCount As Integer Dim str As String rCount = dtb.Rows.Count cCount = dtb.Columns.Count() For c = 1 To cCount oSheet.Cells(1, c) = dtb.Columns(c - 1).Caption '设置列标题 Next c = 0 : r = 0 For r = 1 To rCount For c = 1 To cCount oSheet.Cells(r + 1, c) = CStr(dtb.Rows(r - 1)(c - 1).ToString) Next Next oExcel.Visible = True Catch ex As Exception MsgBox(ex.Message) End Try oExcel = Nothing obook = Nothing oSheet = Nothing End Using