我有將檔案和正文附加到新電子郵件并發送然后關閉電子郵件的代碼。問題是,我收到一個 HCI 彈出框,上面寫著“您要保存這個新檔案嗎?” 當發送的電子郵件關閉時。我一直在嘗試查找有關此的一些資訊,但我無法找到有關決議在彈出框中選擇“否”的答案的任何資訊?
任何鏈接或指導將不勝感激,我已將我的發送代碼包含在背景關系中。
Public Sub LN_Send_Email()
Const EMBED_ATTACHMENT As Long = 1454
Dim Notes As Object
Dim Workspace As Object
Dim UIdoc As Object
Dim Attachment As Object
Dim Data As String
Dim attachmentFile As String
Dim File As String
Dim i As Long
Dim Row As Long
Dim Recipient As String
Dim Doc As Object
Row = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To Row
Recipient = Worksheets("Sheet1").Range("B" & i)
If Recipient <> "" Then
File = Worksheets("Sheet1").Range("A" & i).Value
attachmentFile = "Directory\" & File
Data = Format(Now(), "dd/mm/yyyy")
Set Notes = CreateObject("Notes.NotesSession")
Set Workspace = CreateObject("Notes.NotesUIWorkspace")
Workspace.ComposeDocument , , "Memo"
Set UIdoc = Workspace.CurrentDocument
Set Doc = UIdoc.Document
With UIdoc
.FieldSetText "EnterSendTo", Recipient
.FieldSetText "Subject", "Subject " & Data
.GotoField "Body"
.Import "HTML File", "Directory"
If attachmentFile <> "" Then
If Dir(attachmentFile) <> "" Then
Set Attachment = .Document.CreateRichTextItem("Attachment")
.InsertText String(2, vbLf) & "File attached: " & Mid(attachmentFile, InStrRev(attachmentFile, "\") 1)
Attachment.EmbedObject EMBED_ATTACHMENT, "", attachmentFile
Else
MsgBox "File " & attachmentFile & " not found, so not attached to email."
End If
End If
Application.CutCopyMode = False
.Send
.Close
Application.Wait Now TimeValue("00:00:02")
End With
Set UIdoc = Nothing
Set Workspace = Nothing
Set Notes = Nothing
End If
Next i
End Sub
uj5u.com熱心網友回復:
嘗試設定
doc.SaveOptions = "0"
在您發送檔案之前。該標志告訴客戶端不要提示保存郵件檔案。
如果這不起作用,您可能需要使用 doc(NotesDocument 類)而不是 UIDoc(NotesUIDocument 類)來創建和發送郵件。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/504299.html
