如何在 Outlook 2007 中用宏更改 replyTo 地址?

How to change replyTo address with macro in Outlook 2007?

我正在使用 Outlook 2007。我只想编写一个宏来删除所有收件人并添加一个新收件人。这是我的代码:

Sub replyTo(item As Outlook.MailItem)
    Do While item.ReplyRecipients.Count() > 0
        item.ReplyRecipients.Remove (1)
    Loop
    item.ReplyRecipients.Add ("example@example.com")
    item.ReplyRecipients.ResolveAll
End Sub

我还为 运行 这个脚本创建了一个规则。不幸的是,当我收到一封邮件时,replyTo 邮件没有变成我想要的。

目标不明确但是...

Sub replyToExampleImmediately(item As Outlook.mailitem)

' Ignore the sender of the item and reply to "example@example.com"

    Dim replyItem As mailitem
    Set replyItem = item.reply

    replyItem.Recipients.Remove (1)

    replyItem.Recipients.Add ("example@example.com")
    replyItem.Recipients.ResolveAll

    replyItem.Display

ExitRoutine:
    Set replyItem = Nothing

End Sub


Sub replyTosender(item As Outlook.mailitem)

' Reply to the sender of the item and
'  set the replyTo so the sender will reply to "example@example.com"

    Dim replyItem As mailitem
    Set replyItem = item.reply

    replyItem.ReplyRecipients.Add ("example@example.com")
    replyItem.Display

    ' comment out later
    ActiveInspector.CommandBars.ExecuteMso ("MessageOptions")

ExitRoutine:
    Set replyItem = Nothing

End Sub

Sub replyTo_test()
' First open a mailitem

Dim curritem As mailitem
Set curritem = ActiveInspector.currentItem

replyToExampleImmediately curritem
replyTosender curritem

End Sub