I am trying to access the .To line from an Outlook-Mail I clicked on in Outlook.
Specifically I want to check whether the mail has been sent to a specific email.
Wider view:
Let's say, I click on the mail and my subroutine found out that the mail has been sent to this specific email address(Item.To field). In this case, If the users chooses to reply to that mail (reply-event), the CC-field of the reply-mail should automatically contain another email address the mail will be send to.
What I got so far and isn't working:
Private Sub Application_ItemLoad(ByVal Item As Object)
MsgBox "To: " & Item.To
End Sub
Error: Values and methods of the element could not be handled in this event.
Do I maybe need to cast the object somehow to declare it as a mailitem-object to access the .To field? Or any other suggestions that might work?