Hi all
To keep this brief, I have a working code to copy the body of one email from an Outlook Folder to an excel spreadsheet.
This currently only works for x1 email in a folder, and I would like it to work on ALL the emails in a folder.
Any help would be great!
Private Sub CommandButton1_Click()
Dim ObjOutlook As Object
Dim MyNamespace As Object
Dim i As Integer
Dim j As Long
Dim abody() As String
Set ObjOutlook = GetObject(, "Outlook.Application")
Set MyNamespace = ObjOutlook.GetNamespace("MAPI")
For i = 1 To MyNamespace.GetDefaultFolder(6).Folders("temp").Items.Count
abody = Split(MyNamespace.GetDefaultFolder(6).Folders("temp").Items(i).Body, Chr(13) & Chr(10))
For j = 0 To UBound(abody)
Sheet1.Cells(65000, 1).End(xlUp).Offset(1, 0).Value = abody(j)
Next
MyNamespace.GetDefaultFolder(6).Folders("temp").Items(i).Move MyNamespace.GetDefaultFolder(6).Folders("Processed")
Next
Set ObjOutlook = Nothing
Set MyNamespace = Nothing
End Sub
Bookmarks