VB创建EXCLE表。添加sheet添加数据 保存EXCEL
Dim xlApp As New Excel.ApplicationDim xlBook As New Excel.Workbook
Dim xlSheet As New Excel.Worksheet
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Add
xlApp.Sheets(1).Name = "报名学费收入"
Set xlSheet = xlBook.Worksheets("报名学费收入")
xlSheet.Cells.EntireColumn.AutoFit '自动调整列宽
l="C:\1.xls"
xlApp.ActiveWorkbook.SaveAs l, True
xlApp.Visible = False
xlBook.Close (True) '关闭工作簿
xlApp.Quit '结束EXCEL对象
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing '释放xlApp对象
MsgBox "导出成功", vbInformation, "提示"
在一个工作薄里可以如何添加一个工作薄