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
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.