Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Microsoft Outlook _ Outlook Browse For Email Item

Posted by: Schizolocal Feb 6 2019, 03:18 AM

Hi
I am doing some work on automating Outlook and interacting with Access via VBA. I have discovered the namespace.PickFolder method for bringing up an Outlook dialog to allow the user to browse for, select and return a reference to an Outlook folder, but I am stumped with finding an equivalent function for returning a reference to a selected Item (I am specifically looking at Email items, but I would imagine that any solution would apply to any item type). So, in summary...
Is there any Outlook mechanism, callable from VBA, which allows a user to browse for and select an Item modally, and return a reference to the selected Item object?

Stuart

Posted by: DanielPineault Feb 6 2019, 05:42 AM

I think you're going to have to use .Selection and iterate through the returned items. See: https://docs.microsoft.com/en-us/office/VBA/api/outlook.selection.item

Posted by: Schizolocal Feb 6 2019, 08:45 AM

Thanks for the reply, Daniel.
I've sort of imagined I could do something of the sort, but (if my understanding is correct) it would mean that the selection of the email item in Outlook and the prompt and handling of the selection in Access proceed aysnchronously, i.e. my Access VBA invites the user to switch to Outlook, select the email s/he is interested in, return to Access (which has been waiting for a proceed command from the user), which then handles the selection.
I've a feeling I can make it work, but it is cumbersome.

Am I right?
Is there no way of doing something like displaying the correct Inspector and managing it's behaviour? (my other blue-sky thinking idea)
Stuart




Posted by: DanielPineault Feb 6 2019, 08:53 AM

From my knowledge, there is no way to prompt the user to select a e-mail. Outlook only provide a FolderPicker. It's a real pain. I seen people create their own forms, and read the subjects, etc... to populate their form so they can achieve a better selection process then what is possible directly through Outlook automation.