一直想实现在EXCEL里面操控Lotus,在论坛里搜索未果,于是买了精粹专门来看,输入后也是提示.nsf邮件数据库未打开。再次来论坛搜索,照这个帖子的代码运行居然成功了,不明白两种代码有什么区别,下面是书上的代码: Sub SendEmailbyNotes() Dim nNotes, nDatabase, nDocument, nRTItem As Object On Error GoTo errhandle Set nNotes = CreateObject("Notes.NotesSession") Set nDatabase = nNotes.GETDATABASE("", "EmailBackup.nsf") Set nDocument = nDatabase.CREATEDOCUMENT nDocument.Subject = "测试" nDocument.SendTo = "zhangsan@gmail.com" nDocument.Form = "Memo" nDcoument.SAVEMESSAGEONSEND = True Set nRTItem = nDocument.CREATERICHTEXTITEM("Boby") Call nRTItem.ADDNEWLINE(1) Call nRTItem.APPENDTEXT("这是一个包含附件的测试邮件。") Call nRTItem.ADDNEWLINE(1) Call nRTItem.EMBEDOBJECT(1454, "", "c:\test\test.xls") Call nDocument.SEND(False) Set nNotes = Nothing Set nDatabase = Nothing Set nDocument = Nothing Set nRTItem = Nothing Exit Sub errhandle: MsgBox Err.Description End Sub 请版主或者作者Windland过来瞧瞧,谢谢! |