Extracting received time from an email message

  • Thread starter Thread starter S Shipley
  • Start date Start date
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
 
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
 
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
 
Back
Top