VBA / Outlook 2010 - 从默认邮件地址回复/回复全部

问题描述 投票:0回答:2

使用下面的 VBA 代码,我能够在 Outlook 2010 功能区上创建一个新按钮,我可以通过该按钮使用默认电子邮件地址发送电子邮件。

现在我想在 Outlook 2010 功能区上有一个类似的按钮,用于“回复/回复全部”。当“回复”或“回复全部”时,Outlook 默认选择邮件地址作为邮件的发件人,但我想使用默认电子邮件地址发送所有电子邮件。

这是我在该教程中找到的 VBA 脚本:http://www.sevenforums.com/tutorials/129318-outlook-2010-always-send-default-account.html

Public Sub New_Mail()
Dim oAccount As Outlook.Account
Dim oMail As Outlook.MailItem
For Each oAccount In Application.Session.Accounts
If oAccount = "Name of Default Account" Then
Set oMail = Application.CreateItem(olMailItem)
oMail.SendUsingAccount = oAccount
oMail.Display
End If
Next
End Sub

有什么想法可以更改上述代码吗?或者有人知道如何在 Outlook 功能区上创建此类按钮来“回复”电子邮件吗?

谢谢!

email vba button outlook reply
2个回答
1
投票

我终于解决了!就是下面的代码:

Public Sub Reply_Mail()
Dim oAccount As Outlook.Account
Dim oMail As Outlook.MailItem

For Each oAccount In Application.Session.Accounts

If oAccount = "Name of your mail address" Then
    Set oMail = Application.ActiveExplorer.Selection(1).Reply
      oMail.SendUsingAccount = oAccount
    oMail.Display
End If
Next

End Sub

0
投票

感谢您的建议..但是,如何在每次打开 Outlook 时将其添加为默认值?

© www.soinside.com 2019 - 2024. All rights reserved.