Sub Initialize
On Error Goto err_handle
Dim session As NotesSession
Dim docNew As NotesDocument
Dim ExcelApp As Variant
Dim ExcelBook As Variant
Dim ExcelSheet As Variant
Dim iCount As Integer
Set session = New NotesSession
Set docNew = session.DocumentContext
Set ExcelApp = createObject("excel.application")
ExcelApp.visible =False
Set ExcelBook = ExcelApp.WorkBooks.add
Set ExcelSheet = ExcelBook.WorkSheets(1)
ExcelSheet.cells(1,1).value = "姓名"
ExcelSheet.cells(1,2).value = "年龄"
For iCount =2 To 6
ExcelSheet.cells(iCount,1).value = iCount
ExcelSheet.cells(iCount,2).value = iCount
Next
ExcelApp.ActiveWorkbook.SaveAs("C:/")
ExcelBook.close(True)
ExcelApp.quit
Set ExcelApp =Nothing
Exit Sub
err_handle:
Msgbox "=============================================="
Msgbox ""+Error
Msgbox ""+Cstr(Erl())
Msgbox "=============================================="
End Sub
------解决方案--------------------
ExcelApp.ActiveWorkbook.SaveAs("C:/test.doc")
要这样子写完整路径,是文件路径 not 文件夹路径。