[英]VBA Outlook Signature
我嘗試插入不同的代碼來獲取 Outlook 中的默認簽名,以便在生成電子郵件時顯示在這行代碼的末尾。 有什么建議?
Private Sub CommandButton1_Click()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim signature As String
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = "Hello," & vbCrLf & vbCrLf & "I recently reviewed a call of yours and the information that we reviewed in our coaching session is as follows:" & vbCrLf & vbCrLf & _
"Call Duration: " & Sheets("Sheet1 (13)").Range("j38").Value & vbCrLf & _
"Date: " & Sheets("Sheet1 (13)").Range("j39").Value & vbCrLf & _
"Coaching Feedback: " & Sheets("Sheet1 (13)").Range("J40").Value & vbCrLf & signature
On Error Resume Next
With xOutMail
.To = Range("D39")
.CC = Range("G39")
.BCC = ""
.Subject = "Quality Audit Coaching"
.Body = xMailBody
.Display
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
我看到你有 Dim 簽名變量 Statement 但我沒有看到你分配給任何對象。
如果它不是 HTML 正文,請嘗試以下操作
With xOutMail
.To = Range("D39")
.CC = Range("G39")
.BCC = ""
.Subject = "Quality Audit Coaching"
.Display
.Body = xMailBody & .Body
' .Send
End With
如果它的 HTML Body 然后將其更改為.HTMLBody = xMailBody & .HTMLBody
或者您可以設置Dim signature variable
例子
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
With xOutMail
.Display
signature = .HTMLBody
End With
返回或設置表示指定項的 HTML 正文的字符串。 HTMLBody 屬性應該是 HTML 語法字符串。 讀/寫。
返回或設置一個字符串,表示 Outlook 項目的明文正文。 讀/寫。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.