December 18th, 2012, 06:32 AM
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..
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.*
Public WithEvents myOlItems As Outlook.Items
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?
December 18th, 2012, 12:23 PM
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.
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi
December 19th, 2012, 03:44 AM
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.
Last edited by 1DMF; December 19th, 2012 at 04:30 AM.