Dear Experts,
I found a code on internet to export email message body to excel. When I paste this code in the code window of this worksheet Line 9 turns red indicating something is not right. Full code is:
Function EmailText() As String
Dim ObjOutlook As Object
Dim MyNamespace As Object
Dim i As Integer
Set ObjOutlook = GetObject(, "Outlook.Application")
Set MyNamespace = ObjOutlook.GetNamespace("MAPI")
For i = 1 To MyNamespace.GetDefaultFolder(6).Folders("temp").Items.Count
Sheet1.Cells(i, 1).Value = MyNamespace.GetDefaultFolder(6).Folders("temp").Items(i).Body
MyNamespace.GetDefaultFolder(6).Folders("temp").Items(i).Move MyNamespace.GetDefaultFolder(6).Folders("Processed")
Next
Set ObjOutlook = Nothing
Set MyNamespace = Nothing
End Function
and the line below truns red
MyNamespace.GetDefaultFolder(6).Folders("temp").Items(i).Move MyNamespace.GetDefaultFolder(6).Folders("Processed")
Next
Looking forward for your help to make this code usable.
Best Regards/VKS
Bookmarks