none
VBA property to export "To(Address)" from outlook to excel RRS feed

  • Question

  • I have written a macro to export email objects from Outlook into an excel sheet. I need to find the property code for one more object in Outlook.  I want to be able to export the original intended recipient of the message that I sent.  I have a folder of those people who have responded; however, some are responding from different emails than the one I had originally sent the message too.  If I use the current export functionality provided in Outlook it exports this information with a header saying "To (address)" I have another exporting software that uses this same naming convention.  I need the process to work on both mailItems and meetingItems; however, mailItems at the very least would still be helpful. 

    I would also like to find the code to export the "SentOnBehalfOf" for both mailItems and meetingItems, if possible.

    I have tried:

    objItm.To

    obItm.SentOnBehalfOf

    Thanks for your help,

    Alex

    Thursday, October 31, 2013 8:02 PM

Answers

  • If a recipient responds form a different address, I don't think there is a generic way of finding the original address that the message was sent to.

    Do you see anything in OutlookSpy (click IMessage)? PR_TRANSPORT_MESSAGE_HEADERS is probably your only chance, but I would not hold my breath if I were you...


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, October 31, 2013 8:11 PM

All replies

  • If a recipient responds form a different address, I don't think there is a generic way of finding the original address that the message was sent to.

    Do you see anything in OutlookSpy (click IMessage)? PR_TRANSPORT_MESSAGE_HEADERS is probably your only chance, but I would not hold my breath if I were you...


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, October 31, 2013 8:11 PM
  • Hi Dmitry,

    in Outlook 2007 it is however possible to use an export to Excel function. That function did export the intended recipient. Why is this not possible via VBA? I looked through most of the outlook item sctructure without any success.

    Cheers!


    • Edited by besa_muc Wednesday, December 4, 2013 2:38 PM
    Wednesday, December 4, 2013 2:38 PM
  • Can you be more specific? What does the message contain and what do you see when you export to Excel?

    What do you see in OutlookSpy?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, December 4, 2013 2:42 PM