资源描述:
《用vba操纵lotus_notes发邮件》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、287,用lotusnotes发送邮件,第一种方法,SubSendWithLotus()DimnoSessionAsObject,noDatabaseAsObjectDimnoDocumentAsObject,noAttachmentAsObjectDimFileSelfAsStringDimiAsLongConstEMBED_ATTACHMENT=1454ConststSubjectAsString="ForLotusVBAProgrammingTestonly"DimstMsgAsStringFile
2、Self=ThisWorkbook.Path+""+ThisWorkbook.NamestMsg="Bst&Rgds"&vbCrLf&_Application.UserName&vbCrLf&_vbCrLf&_"**************************************************************************"&vbCrLf&_"(This'sanautomatede-mailnotification,pleasedonotreplythismessag
3、e.)"DimvaRecipientAsVariantvaRecipient=VBA.Array("huangfeng8211@163.com")'InsertLotusNotesCOMobject.SetnoSession=CreateObject("Notes.NotesSession")SetnoDatabase=noSession.GETDATABASE("","D:otesdatamail3tonyhf.nsf")IfnoDatabase.IsOpen=FalseThennoDatab
4、ase.OPENMAILSetnoDocument=noDatabase.CREATEDOCUMENTSetnoAttachment=noDocument.CREATERICHTEXTITEM("Body")noAttachment.EMBEDOBJECTEMBED_ATTACHMENT,"",FileSelfWithnoDocument.Form="Memo".SendTo=vaRecipient.Subject=stSubject.Body=stMsg.SAVEMESSAGEONSEND=True.P
5、ostedDate=Now().SEND0,vaRecipientEndWithSetnoDocument=NothingSetnoDatabase=NothingSetnoSession=NothingAppActivate"MicrosoftExcel"MsgBox"Thisfilebesent",vbInformationEndSub第二种方法SubSendWithLotus()DimnoSessionAsObject,noDatabaseAsObjectDimnoDocumentAsObject,
6、noAttachmentAsObjectDimvaFilesAsVariantDimiAsLongConstEMBED_ATTACHMENT=1454ConststSubjectAsString="ForLotusVBAProgrammingTestonly"ConststMsgAsString="Thisfileisforyou!justforreference"&vbCrLf&"IamStanleyPan"DimvaRecipientAsVariantvaRecipient=VBA.Array("st
7、anleypan2000@hotmail.com","stanley.pan@IsolaAg.com")vaFiles=Application.GetOpenFilename(FileFilter:="ExcelFiler(*.xls),*.xls",Title:="AttachfilesforoutgoingE_Mail",MultiSelect:=True)IfNotIsArray(vaFiles)ThenExitSub'InsertLotusNotesCOMobject.SetnoSession=C
8、reateObject("Notes.NotesSession")SetnoDatabase=noSession.GETDATABASE("","D:otesdatamail3tonyhf.nsf")IfnoDatabase.IsOpen=FalseThennoDatabase.OPENMAILSetnoDocument=noDatabase.CREATEDOCUMENTSetnoAttachment=noDocum