alcibiades
New member
- Local time
- Today, 07:12
- Joined
- Jul 27, 2010
- Messages
- 4
I have the following code to save e-mails from outlook to a text file, however, I want to save the body of the e-mail only. The problem is when .msg converts to .txt, the saved text file has a bunch of wingdings & corrupted data. I'm hoping that saving the body of the message only will solve this problem. Thank you in advance for your help.
Dim myOlapp As Outlook.Application
Dim myNameSpace As Outlook.Namespace
Dim myFolder As Outlook.MAPIFolder
Dim myItem As Outlook.MailItem
Set myOlapp = CreateObject("Outlook.Application")
Set myNameSpace = myOlapp.GetNamespace("MAPI")
Set myFolder = myNameSpace.Folders("Mailbox - Inbox").Folders("Inbox")
For Each myItem In myFolder.Items
If InStr(myItem.Subject, "E-mail Subject") And myItem.SentOn > Date Then
myItem.SaveAs "Y:\Email.txt"
myItem.UnRead = False
End If
Next
Dim myOlapp As Outlook.Application
Dim myNameSpace As Outlook.Namespace
Dim myFolder As Outlook.MAPIFolder
Dim myItem As Outlook.MailItem
Set myOlapp = CreateObject("Outlook.Application")
Set myNameSpace = myOlapp.GetNamespace("MAPI")
Set myFolder = myNameSpace.Folders("Mailbox - Inbox").Folders("Inbox")
For Each myItem In myFolder.Items
If InStr(myItem.Subject, "E-mail Subject") And myItem.SentOn > Date Then
myItem.SaveAs "Y:\Email.txt"
myItem.UnRead = False
End If
Next