I want to extract text, from emails in an Outlook Folder named "FaxReceipt", to an Excel spreadsheet
I have created a column name "FaxReceipt". I want all text extracted into the Excel column.
Sub OutlookEMails1()
Dim ns As Namespace
Dim Inbox As MAPIFolder
Dim myitem As Outlook.MailItem
Dim FileName As String
Dim i As Integer
Dim objSearchFolder As Outlook.MAPIFolder
Dim item As Object
Dim mai As MailItem
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set objSearchFolder = Inbox
i = 0
If Inbox.Items.Count = 0 Then
MsgBox "Inbox is Empty", vbInformation, "Nothing Found"
End If
For Each item In Inbox.Items
vbody = item.Body
Range("A2").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1).Select
Loop
ActiveCell.Value = vbody
Next
Set objSearchFolder = Nothing
Set Inbox = Nothing
Set ns = Nothing
End Sub
This code is only working on the default Inbox folder.