我的电脑安装了lotus notes 6,但运行下面的代码到红字部分,就出现“未设置对象“错误,我已经在应用中勾选了lotus notes automatic classes ,请问是何原因。 Sub SendWithLotus() Dim noSession As Object Dim noDatabase As Object Dim noDocument As Object Dim noAttachment As Object Dim vaFiles As Variant Dim i As Long Const EMBED_ATTACHMENT = 1454 Const stSubject As String = "文件發送測試" Const stMsg As String = "This File Is For You! Just For Reference" & _ vbCrLf & "I am PC-6" Dim vaRecipient As Variant vaRecipient = VBA.Array("danis@3126.com", "rockylee@3126.com") vaFiles = Application.GetOpenFilename(FileFilter:="Excel Filer (*.xls),*.xls", _ Title:="Attach files for outgoing E_Mail", MultiSelect:=True) If Not IsArray(vaFiles) Then Exit Sub 'Insert Lotus Notes COM object. Set noSession = CreateObject("Notes.NotesSession") Set noDatabase = noSession.GetDataBase("", "") If noDatabase.IsOpen = False Then noDatabase.OPENMAIL Set noDocument = noDatabase.CreateDocument Set noAttachment = noDocument.CreateRichTextItem("Body") 'Set noAttachment = noDocument.CreateRichTextItem("Body1") With noAttachment For i = 1 To UBound(vaFiles) .EmbedObject EMBED_ATTACHMENT, "", vaFiles(i) Next i End With With noDocument .Form = "Memo" .SendTo = vaRecipient .Subject = stSubject .Body = stMsg .SaveMessageOnSend = True .PostedDate = Now() - 100 .Send 0, vaRecipient End With Set noDocument = Nothing Set noDatabase = Nothing Set noSession = Nothing AppActivate "Microsoft Excel" MsgBox "This file is send OK", vbInformation End Sub |