Dim xlApp As New Excel.Application, xlBook As New Excel.Workbook, xlSheet As New Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add '新建Excel
Set xlBook = xlApp.Workbooks.Open("C:\a.xls") '打开固定文件,如果需要选择文件打开则使用CommonDialog1或(DriverListBox+DirListBox+FileListBox)组合选定文件再打开
Set xlSheet = xlBook.Worksheets(1) ‘指定第一个工作表为活动表
xlApp.Visible = True ’显示Excel
xlapp.WindowState = xlMaximized '最大化
处理完毕需要关闭的话
xlbook.close
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
xlApp.Quit