extracting text from multiple emails?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

is there a way to extract text from multiple emails into a text or doc file?

I.E. Name : John Doe ==>> John Doe in Name.txt
 
Try this macro. Just select the e-mail you want merged, provide a file name
(e.g. C:\Temp\output.txt) to the prompt, and presto!

Sub MergeTextFromSelectedEmailsIntoTextFile()
Dim objFS As New Scripting.FileSystemObject, objFile As
Scripting.TextStream
Dim objItem As Object, strFile As String

If ActiveExplorer.Selection.Count = 0 Then Exit Sub

strFile = InputBox("Please enter the full path and file name for the
merged text:" _
, "Enter File Name")

Set objFile = objFS.CreateTextFile(strFile, False)

If objFile Is Nothing Then
MsgBox "Error creating file '" & strFile & "'.", vbOKOnly +
vbExclamation _
, "Invalid File"
Exit Sub
End If

For Each objItem In ActiveExplorer.Selection
objFile.Write objItem.Body
Next
objFile.Close

MsgBox "Email text extraction completed!", vbOKOnly + vbInformation,
"DONE!"

Set objFS = Nothing
Set objFile = Nothing
Set objItem = Nothing
End Sub
 
Back
Top