ffmsingh
ffmsingh

Reputation: 151

Outlook - export mail to text on rule of vba

I am pretty sure that this has been done before.

Does anybody know how to export emails, into text files on to my c drive, i know how to move emails into other folders in outlook but on my c drive.

Thanks.

Upvotes: 0

Views: 5307

Answers (1)

JimmyPena
JimmyPena

Reputation: 8754

Check out the MailItem.SaveAs Method. You specify the path and file type.

Ex:

Sub SaveEmail()

Dim msg As Outlook.MailItem

  ' assume an email is selected
  Set msg = ActiveExplorer.Selection.Item(1)

  ' save as text
  msg.SaveAs "C:\MyEmail.txt", olTXT

End Sub

The file type is a OlSaveAsType constant. Press F2 in the VBA Editor and paste this into the search box for the list of possible values.

Upvotes: 1

Related Questions