Hi,
Currently, I'm extracting tables from a specified Outlook email address. But now i want to make this VBA look through 2 different Outlook email addresses in order to find the specified email subject.
Can someone help me figure out how this loop would work please?
Below is the code I currently have. Fyi, I only included the relevant code. If you need the full code, please let me know. I'm pretty sure that the loop will have to take place on the line: "Set oMapi..."
Thanks in advance
Currently, I'm extracting tables from a specified Outlook email address. But now i want to make this VBA look through 2 different Outlook email addresses in order to find the specified email subject.
Can someone help me figure out how this loop would work please?
Below is the code I currently have. Fyi, I only included the relevant code. If you need the full code, please let me know. I'm pretty sure that the loop will have to take place on the line: "Set oMapi..."
Code:
' point to first desired email address
Const strMail As String = "first.email@emailaddress.com"
' point to first desired email address
Const strMail2 As String = "second.email@emailaddress.com"
Set oMapi = oApp.GetNamespace("MAPI").Folders(strMail).Folders("inbox")
For Each oItem In oMapi.Items
If oItem.Subject = myvar Then
Exit For
End If
Next oItem
If Not oItem Is Nothing Then
' get html table from email object
Dim HTMLdoc As MSHTML.HTMLDocument
Dim tables As MSHTML.IHTMLElementCollection
Dim table As MSHTML.HTMLTable
Thanks in advance