I am new to VBA coding. I have a code which allows to search my Outlook inbox for a specific Subject and pastes the body of the email into the first column. I have gotten it to separate each email, but it it is only pasting in one column and also the entire email. Each email contains a table and I only want the table to be put into excel. Any ideas ? The table has 6 columns "ID" "Type" "Last Name" "First Name" "Doc Type" and "Doc Description"
All I really am looking for is a code that takes the body I have imported from the current code and removed everything, but the table
the Body looks like
The following are available for viewing:
(This is the table)
ID Type LAST_NAME FIRST_NAME DOC_TYPE Doc_Description
00000 test DOE John 0000 0000
Report : DocType
Report Source: IS reports
= 0000
Sub GetFromInbox()
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olFldr As Outlook.MAPIFolder
Dim olItms As Outlook.Items
Dim olMail As Variant
Dim i As Long
Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olFldr = olNS.GetDefaultFolder(olFolderInbox)
Set olItms = olFldr.Items
olItms.Sort "Subject"
i = 1
lrow = 1
For Each olMail In olItms
If InStr(1, olMail.Subject, "Test ") > 0 Then
ThisWorkbook.Sheets("Sheet1").Cells(i, 1).Value = olMail.Body
i = i + 1
End If
Next olMail
Set olFldr = Nothing
Set olNS = Nothing
Set olApp = Nothing
End Sub
question from:
https://stackoverflow.com/questions/65907385/vba-coding-read-email-by-subject-paste-in-excel-past-and-separate-specific-d 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…