' 可以用GetObject函数,比用new创建excel对象好,不会有多个进程
Set ExcelApp = GetObject(, "Excel.Application")
If Err Then
Err.Clear
Set ExcelApp = CreateObject("Excel.Application")
If Err Then
Err.Clear
MsgBox "无法启动Excel,请检查是否正确安装!"
Exit Sub
End If
End If
Set Excelbook = ExcelApp.Workbooks.Add
Set ExcelSheet = Excelbook.Sheets.Item(1)