我正在尝试实现一个宏,该宏将使用共享模板答复选定电子邮件的发件人。
目前,我有两个单独的宏。
-
将回复发件人并插入其地址。
-
将用模板答复(但不插入发件人地址)。
我想知道是否可以将两者结合起来实现我的目标?这样,当您运行宏时,它将回复带有模板的电子邮件,并填写原始发件人的地址和主题?
我对 VBA 的了解非常有限,因此我不确定 if/how 是否可行。这就是我所拥有的。
1:
Public Sub AccountSelection()
Dim oAccount As Outlook.Account
Dim strAccount As String
Dim olNS As Outlook.NameSpace
Dim objMsg, oMail As MailItem
Set olNS = Application.GetNamespace("MAPI")
Set objMsg = ActiveExplorer.Selection.Item(1).Reply
If TypeName(ActiveExplorer.Selection.Item(1)) = "MailItem" Then
Set oMail = ActiveExplorer.Selection.Item(1)
On Error Resume Next
For Each Recipient In oMail.Recipients
strRecip = Recipient.Address & ";" & strRecip
Next Recipient
If InStr(strRecip, "alias@domain1.com") = 1 Then
strAccount = "alias@domain1.com"
Else
End If
For Each oAccount In Application.Session.Accounts
If oAccount.DisplayName = strAccount Then
objMsg.SendUsingAccount = oAccount
Else
End If
Next
objMsg.Display
Else
End If
Set objMsg = Nothing
Set olNS = Nothing
End Sub
Sub TacReply()
Dim origEmail As MailItem
Dim replyEmail As MailItem
Set origEmail = Application.ActiveExplorer.Selection(1)
Set replyEmail = Application.CreateItemFromTemplate("S:\Share\TWGeneral.oft")
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.SentOnBehalfOfName = "email@domain.com"
replyEmail.Display
End Sub
任何帮助将非常感激!谢谢!
1 回答
确定 name(s)发送答复,不一定是发送方
.