Outlook Email Fields from Excel

eblake

Active Member
Joined
Aug 18, 2004
Messages
258
I am using a modified version of the code from this post to count emails in an Outlook folder
http://www.mrexcel.com/forum/showthread.php?t=293671

My problem is I can't seem to access the fields I need to get the data I need, Does anyone have some code that will list all the available fields in an email?

We have a couple of custom fields that I can't seem to access as well and i'm wondering if they might be named something other than what we see them as.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
what fields are you after from outlook
 
Upvote 0
Sorry for the delay in getting back on this, boss dropped another project on me.

I just need the basic fields: DateTime Recvd, DateTime Replied, From, To, CC, BCC, Subject, Attachments

The boss wants me to look into a way to have outlook process all incoming emails to stick the information in a SQL table and build a web based front end for it. (Admins wont let me link SQL directly to exchange so it has to be client side)

From everything i've been reading and done in the past, this is possible I just need to figure out how to grab the field information. That's where i'm stuck. I can't seem to figure out the field names that vba wants me to use to get the information from the email.

Thanks
 
Upvote 0
Code:
Sub extractinfo()
'
' setup what we require
'
Dim msg As MailItem

Set olExp = Outlook.ActiveExplorer
Set olCurrentFolder = olExp.CurrentFolder
Set myOlSel = olExp.Selection

'
' Process each message selected
'
' just need the basic fields: DateTime Recvd, DateTime Replied, From, To, CC, BCC, Subject, Attachments

For Each msg In myOlSel
    mRTime = msg.ReceivedTime
    mBcc = msg.BCC
    mCC = msg.CC
    mTo = msg.To
    mFrom = msg.SenderEmailAddress
    mSubj = msg.Subject
'
'****
' if you start a line with say fred = msg.
' you will get a dropdown of available fields you can pull, attachments is a bit strange
' i will look out some code on home machine to do this
' you will have to decide how you store these like appending to a text file, delimited
' so that SQL or excel can import it
'****
'

    Set msg = Nothing
Next

End Sub
 
Upvote 0
by the way the code just posted is for Outlook VBA so it is driven from Outlook, you select which emails you want to process with the mouse then execute the macro
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top