Received Date Time

  • Thread starter Thread starter Guest
  • Start date Start date
This example should give you a headstart:

Sub ExportPropertyValueFromActiveMessageToExcel()
On Error Resume Next

'Must have the e-mail in question open
'Ensure that you have set a reference to the Microsoft Excel X.0 Object Model
Dim objMail As Outlook.MailItem
Dim objWkb As Excel.Workbook, objWks As Excel.Worksheet
Dim objExcel As Excel.Application

If ActiveInspector Is Nothing Then Exit Sub 'No open e-mail
If ActiveInspector.CurrentItem.Class <> olmail Then Exit Sub 'only work
with e-mail items

Set objMail = ActiveInspector.CurrentItem
Set objExcel = New Excel.Application
Set objWkb = objExcel.Workbooks.Add
Set objWks = objExcel.ActiveSheet
objExcel.Visible = True

'Populate Column A, Row 1
objWks.Cells(1, 1) = objMail.ReceivedTime

Set objWks = Nothing
Set objExcel = Nothing
Set objWkb = Nothing
Set objMail = Nothing
End Sub
 
Back
Top