Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting values from currently selected email 1

Status
Not open for further replies.

ribsa3

Programmer
Jun 17, 2003
56
..if at all possible

Just tinkering, I am trying to make a little snippet of code quite simply displaying the subject of the selected message in a MsgBox or preferrably a control in a little form.

This is my first shot in the dark using vba in Outlook, and my first impression is that it's awkward. In any case, I have found neither objects nor methods nor properties referring to the currently selected message in Outlook (firstly from the list of emails in, say, the Inbox - but also if a message has been opened).

Any good ideas? Fill in the blank..

MsgBox <blank>

Thanks in advance!

Kindly,
Bjoern Sandvik



--------------------------------------------------------------------
Do what you wish, as long as it harms no one. That includes yourself.
 
Outlook IS awkward.

It can be done, although I must ask why you want to do this. Is not the subject visible in the pane when you select a message? What exactly are you trying to do?


Gerry
 
Hi Gerry

I'm first off trying to find ways to extract basic data from email messages (From, To, CC, Subject and message body) to incorporate a way to export this simple data into a separate storage (our CRM system)

The reason I picked a MsgBox is that it is the quick and easy way I use to present a value - debugging

-Bjoern



--------------------------------------------------------------------
Do what you wish, as long as it harms no one. That includes yourself.
 
Outlook is a right little pain in the £$%"£ to code (the little I have done anyway). As a starter for 10, this may help you move forward:

Code:
Set myOlApp = CreateObject("Outlook.Application")
'Next line sets a variable equal to the  OPEN email item
Set myItem = myOlApp.ActiveInspector.CurrentItem
'From there, you can then interrogate the properties of the item
sSubject = myItem.Subject
sDate = myItem.CreationTime


Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Hi again

This worked quite nicely, but I wish I wouldn't have to actually open the selected item (message) to get hold of the object properties and methods. Is it possible in some way to access these from the main Outlook messages view or am I pushing it? (I am having hopes to manipulate other Outlook objects as well - such as the calendar)

Thanks for any tips!
-Bjoern



--------------------------------------------------------------------
Do what you wish, as long as it harms no one. That includes yourself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top