關閉廣告

【求助】VBA在調用Lotus Notes的時候,發信時,可以先預覽再寄出

大家好:
目前VBA遇到在調用Notes寄信時,信件都會直接寄出,無法先預覽再寄出,可否有人可以協助

Sub Notes寄信()
Dim noSession As Object, noDatabase As Object
Dim noDocument As Object, noAttachment As Object
Dim FileSelf1, attPath As String
attPath = "C:\新資料夾\"
Const EMBED_ATTACHMENT = 1454
stSubject = "寄信test" '文件標題
Dim stMsg As String
Dim vaRecipient As Variant

vaRecipient = XXX '收件人

'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
FileSelf1 = attPath & "test.txt"

stMsg = "hellow" '內文

Set noAttachment = noDocument.CreateRichTextItem("Body1")
noAttachment.EmbedObject EMBED_ATTACHMENT, "", FileSelf1 '附件一


With noDocument
.Form = "Memo"
.SendTo = vaRecipient
.Subject = stSubject
.Body = stMsg
.SaveMessageOnSend = True 'False 不要備份
.PostedDate = Now()
.Send 0, vaRecipient
End With

Set noDocument = Nothing
Set noDatabase = Nothing
Set noSession = Nothing
Set noAttachment = Nothing
End Sub
文章關鍵字
'.Send 0, vaRecipient

註解掉上面這行試試
文章分享
評分
評分
複製連結

今日熱門文章 網友點擊推薦!