我想自动创建电子邮件的第一部分,即“亲爱的发件人姓名“在 Outlook 中。我相信这是可能的,因为姓名可以从发送电子邮件的人的姓名字段中得出(即名称字段[电子邮件字段] 出现在电子邮件顶部)。我该如何实现这一点?
答案1
这是邮件合并功能,Microsoft Outlook博客介绍如何设置
从 Outlook 创建邮件合并电子邮件的基本步骤是:
- 在 Outlook 中选择联系人
- 在邮件合并对话框中选择发送电子邮件并选择主题
- 在 Word 中撰写电子邮件 – 在适当的位置插入字段
- 预览并发送
请阅读上面链接的博客文章中的详细信息。
答案2
Sub InsertNameInReply()
Dim Msg As Outlook.MailItem
Dim MsgReply As Outlook.MailItem
Dim strGreetName As String
Dim lGreetType As Long
' set reference to open/selected mail item
On Error Resume Next
Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set Msg = ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set Msg = ActiveInspector.CurrentItem
Case Else
End Select
On Error GoTo 0
If Msg Is Nothing Then GoTo ExitProc
strGreetName = Mid$(Msg.SenderName, 2 + InStr(1, Msg.SenderName, ", ", Len(Msg.SenderName)) - 1)
Set MsgReply = Msg.Reply
With MsgReply
.Subject = "RE:" & Msg.Subject
.HTMLBody = "<span style=""font-family : verdana;font-size : 10pt""><p>Hello " & strGreetName & ",</p></span>" & .HTMLBody
.Display
End With
ExitProc:
Set Msg = Nothing
Set MsgReply = Nothing
End Sub