Extracting received time from an email message

S

S Shipley

I have used VBA for Excel and Word but this is my first foray into VBA for
Outlook so please forgive the newbie. I need to create a macro that takes an
open received email item and:
Extracts the From email address
The received time (need to have this in hh:mm:ss)
Displays both of these values in a message box
Is this even possible?

Thanks in advance for the help,
Sam
 
J

JP

Sure, how about this?

Sub GetStuff()
Dim CurrentMsg As Outlook.MailItem
Set CurrentMsg = ActiveInspector.CurrentItem

MsgBox CurrentMsg.SenderEmailAddress & vbCr & vbCr & _
Format(CurrentMsg.ReceivedTime, "HH:MM:SS")

End Sub


Just double click to open the msg, then run this code.

HTH,
JP
 
S

S Shipley

Thanks JP - just what the doctor ordered.

JP said:
Sure, how about this?

Sub GetStuff()
Dim CurrentMsg As Outlook.MailItem
Set CurrentMsg = ActiveInspector.CurrentItem

MsgBox CurrentMsg.SenderEmailAddress & vbCr & vbCr & _
Format(CurrentMsg.ReceivedTime, "HH:MM:SS")

End Sub


Just double click to open the msg, then run this code.

HTH,
JP
 

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