tags:

views:

708

answers:

1

I am completely stuck as to how to retrieve details of an email which is either currently selected or open. In fact, I can't find any details on how to access an email. It seems you can traverse the entire folder structure and get all emails, but that doesn't really help me.

I don't suppose I can get some pointers?

And yes, I hate VBA as much as the next developer, but unfortunately about 0.1% of my work involves integration with Outlook.

Cheers.

+2  A: 

Hi, To get the currently selected emails by looking at the Selection object of the Explorer.

Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection

Set myOlExp = Application.ActiveExplorer
Set myOlSel = myOlExp.Selection

The selection object can contain many items and also contain Items that are of other types than mail (IPM.Note) i.e calendar apps etc. So if you only want mail items you can take a look at the item MessageClass

As for the current email that is trickier as you can multuiple of these open if you just want the top most you can use the Application.ActiveInspector otherwise you should look at the Inspectors Collection of the Application object. You can then get the "item" from the CurrentItem property off the Inspector(remember these can be non mails as well)

Hope full that will get you going

76mel