我已在Outlook VBA下創建了一個宏,該回復的發件人名添加到了問候語中,爲主體添加了一些文本,並在我想要的字體。帶有個人收件人姓名(原始電子郵件的發件人姓名)的Outlook回覆
我需要幫助的是讓宏拉取發件人的所有名稱,爲他們分配一個值,然後我可以將其放置在電子郵件正文的其他地方。如果做不到這一點,我會解決所有問題的名字,儘管能夠移動名字是最好的選擇。
例如:發件人是名1,名稱2
目前,該宏將僅拉出名1(給「親愛的名稱1」),但 我想獲得到「親愛的NAME 1和NAME,」至少是。 Best將能夠在問候語中使用Name1,然後將Name2放置在文本的正文中。
我相信我已經把這個盡我所能,並且現在請求專家幫忙!謝謝!!
Sub AutoAddGreetingtoReply()
Dim oMail As MailItem
Dim oReply As MailItem
Dim GreetTime As String
Dim strbody As String
Dim SigString As String
Dim Signature As String
Dim R As Outlook.Recipient
Dim strGreetName As String
Select Case Application.ActiveWindow.Class
Case olInspector
Set oMail = ActiveInspector.CurrentItem
Case olExplorer
Set oMail = ActiveExplorer.Selection.Item(1)
End Select
strbody = "<H3><B></B></H3>" & _
"<br><br><B></B>" & _
"Please visit this website to view your transactions.<br>" & _
"Let me know if you have problems.<br>" & _
"<A HREF=""http://www.google.com"">Questions</A>" & _
"<br><br>Thank you"
SigString = Environ("appdata") & _
"\Microsoft\Signatures\90 Days.htm"
On Error Resume Next
If Dir(SigString) <> "" Then
strGreetName = Left$(oMail.SenderName, InStr(1, oMail.SenderName, " ") - 1)
End If
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
Set oReply = oMail.ReplyAll
With oReply
.CC = ""
.HTMLBody = "<Font Face=calibri>Dear " & strGreetName & "," & R1 & strbody & "<br>" & Signature
.Display
End With
End Sub
On Error Resume Next阻礙了學習。 http://www.cpearson.com/Excel/ErrorHandling.htm – niton