我正在尝试根据特定地址是在出站邮件的“收件人”还是“抄送”字段中设置出站电子邮件的回复地址。我已经走到这一步,只是在“Set myCounter ...”行中偶然发现“Object required”错误。任何帮助将不胜感激:
Option Explicit
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim oMyItem As Outlook.MailItem
Dim i As Integer
Dim AddressEntry As AddressEntry
Dim myCounter As Integer
Set oMyItem = Item
Set myCounter = oMyItem.Recipients.Count
For i = 1 To myCounter
Set AddressEntry = oMyItem.Recipients(i).AddressEntry
If (AddressEntry = "someuser@someaddress") Then
oMyItem.ReplyRecipients.Add "replytouser@someaddress"
End If
Next i
End Sub