Attribute VB_Name = "Module1" Option Explicit Sub DigalertWriteToFile(item As Outlook.mailItem) Dim ol As Outlook.Application Dim ns As Outlook.namespace Dim fol As Outlook.folder Dim i As Object Dim mi As Outlook.mailItem Dim s As String Dim n As Integer Dim EmAd As String Open "Z:\OCSurvey\Digalert\DigalertEmailOutlookExtraction.txt" For Output As #1 Close #1 Set ol = New Outlook.Application Set ns = ol.GetNamespace("MAPI") Set fol = ns.GetDefaultFolder(olFolderInbox).Folders("To Be Posted") For Each i In fol.Items If i.Class = olMail Then Set mi = i s = CStr(mi.Body) n = FreeFile() Open "Z:\OCSurvey\Digalert\DigalertEmailOutlookExtraction.txt" For Append As #1 s = CStr(mi.Body) Debug.Print s Write #1, s ' other way of writing to file Close #1 End If Next i End Sub