#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246

    Add an event listenter to outlook sent items in MS Access


    I am having trouble tracking a sent email in MS Access due to the fact EntryID changes constantly.

    I have read that the way to do it is trap the AddItem event handler for the Sent Items folder.

    However, all the examples I have seen, start with the following piece of code..
    Code:
    Public WithEvents myOlItems As Outlook.Items
    How do I set up a variable for collecting the sent item with events when I'm using late bindings so there is no user-type of Outlook.*

    I've tried using Object and Variant but that errors, so I assume these data types can't have events.

    Any ideas how I achieve obtaining the sent items email EntryID using late bindings?

    Thanks,
    1DMF
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,451
    Rep Power
    4539
    I think you need to write your code in Outlook VBA not Access VBA, then in the outlook code you can use ADO to manipulate the access db. Just guessing though, I haven't used either app vba in a few years now.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    That would mean having to ship an Outlook macro or plugin or something to everyones Outlook, which I don't want to do. Plus I dont want an event triggered for every email they send, just for those being sent through a specific application, which is why it needs to be in that application.

    Though, it turns out you cannot add event handlers to variables declared as 'Object' , so it isn't possible to achieve this while using late bindings!

    I've come at it from a different angle and have a working prototype for retrieving the email from the sent items so, I'm going to go down that route and see where it takes me.

    Regards,

    1DMF
    Last edited by 1DMF; December 19th, 2012 at 05:30 AM.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!

IMN logo majestic logo threadwatch logo seochat tools logo