在outlook中访问Item.To VBA
问题描述:
在宏中,我需要在输入电子邮件时访问Item.To中的名称。
例如,在输入电子邮件时转到工具菜单并从“宏”子菜单运行宏。在outlook中访问Item.To VBA
当代码尝试使用Item.To时出现调试异常,调试工具告诉我“Object required”。
我可以访问Item.To执行Application_ItemSend,所以我有一部分权利。
感谢您考虑它,我被困在这一个!
答
我已经能够访问要使用类似下面的代码在过去行:
With Application.ActiveInspector
If TypeOf .CurrentItem Is Outlook.MailItem Then
Debug.Print "To: " & .CurrentItem.To
'If you want to access each recipient
Set myRecipients = .CurrentItem.Recipients
Dim myRecipient As recipient
Dim recipientToList As New Collection
For Each myRecipient In myRecipients
recipientToList.Add myRecipient.Name
Next
End If
End With
我已经装了一个ArrayList
与每个收件人用于排序等
谢谢!完美的作品。我已将以下子代添加到我的宏列表中以尝试您的代码: – 2011-02-09 12:29:37