Current Selected Mail Item

P

Phil

Hello all,
I am currently writing an Outlook 2002 AddIn using VB6 but
I am having difficulty returning the currently
selected/highlighted email message within the Inbox.
What I have at the moment just returns the last email
message not the selected message.

Set myInbox = olns.GetDefaultFolder(olFolderInbox)
MsgBox myInbox.GetExplorer.Selection.Item(1).Subject

NOTE
I don't want the user to have to open the email therefore
the objOutlook.ActiveInspector option is not what I am
after.

Any help on the matter would be greatly appreciated.
 
P

Paul Overway

Although not specific to the Inbox, this should work (does for me anyway):

Set objExplorer = olApp.ActiveExplorer
Set objSelection = objExplorer.Selection
Set objTemp = objSelection.Item(1)

Where olApp is your Outlook application object.
 
P

Phil

Thanks Paul, that works a treat...

Phil.
-----Original Message-----
Although not specific to the Inbox, this should work (does for me anyway):

Set objExplorer = olApp.ActiveExplorer
Set objSelection = objExplorer.Selection
Set objTemp = objSelection.Item(1)

Where olApp is your Outlook application object.

--
Paul Overway
Logico Solutions, LLC
www.logico-solutions.com





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top