Extracting Senders name and body of message

K

kerry

How would I go about extracting the senders name and body of email and import
into an access database table?
 
M

Michael Bauer

Hi Kerry,

this sample prints the properties of the first Inbox item into the debug
window (strg-g):

Dim oItems as Outlook.MapiFolder
Dim oMail as Outlook.MailItem
Dim obj as Object

Set oItems=Application.Session.GetDefaultFolder(olFolderInbox).Items

If oItems.Count Then
Set obj=oItems(1)
If typeOf obj Is Outlook.MailItem Then
Set oMail=obj
debug.Print oMail.SenderName, oMail.Body
Endif
Endif

Infos for connecting to a database:
http://www.outlookcode.com/d/database.htm
 
Top