首页 文章

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

提问于
浏览
1

使用下面的 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 功能区上创建此类按钮以“回复”电子邮件?

谢谢!

1 回答

  • 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
    

相关问题