ThrottleWorks
Excel Ninja
Hi,
I am trying to export an e-mail to excel worksheet.
But am not able to do so. I want to export e-mail with its original format to excel.
E-mail contains few text lines and a table, I need to export it to excel as it is for further processing.
I want to copy e-mail and paste in excel. But I do not know how to use 'e-mail copy' in VBA.
The code I am using is not helpful for this. Can anyone please help me in this.
I am trying to export an e-mail to excel worksheet.
But am not able to do so. I want to export e-mail with its original format to excel.
E-mail contains few text lines and a table, I need to export it to excel as it is for further processing.
I want to copy e-mail and paste in excel. But I do not know how to use 'e-mail copy' in VBA.
The code I am using is not helpful for this. Can anyone please help me in this.
Code:
Sub ExportEmailToExcel()
Dim MyItem As Outlook.MailItem
Dim myAttachments As Outlook.Attachments
Dim objApp As Object
Dim i As Long
Dim Att As String
Dim sFile As Variant
Dim myOutput As Variant
Dim Filename As Variant
Dim RawBook As Variant
Dim RawSht As Variant
Dim myShell As Variant
Set objApp = Outlook.Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set MyItem = ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set MyItem = ActiveInspector.CurrentItem
Case Else
End Select
On Error GoTo 0
Dim EmailDump As Worksheet
Set EmailDump = ThisWorkbook.Worksheets("EmailDump")
EmailDump.Range("A1") = MyItem.Body
Set myAttachments = Nothing
Set MyItem = Nothing
Set myShell = Nothing
End Sub