| || |
How to find links in the body of a Outlook.Application
Does anyone know how to get all the links in the body of a Outlook.Application
Need to Verify 3 different URLs displayed in Email message
Thanks in advance
You should find the links text and then reported it.
This code find the text in the body :
Set objOutlook = CreateObject("Outlook.Application")
Set myNameSpace = objOutlook.GetNameSpace("MAPI")
Set oFolder = myNameSpace.GetDefaultFolder(6) 'Inbox = 6
For i = 1 to oFolder.Items.Count
Set oItem = oFolder.Items(i)
sSubject = oItem.Subject
sBody = oItem.Body
If instr(1,sBody,"the text you seek") >0 Then
I was hoping for something else
I have this which finds first URL.
' Verify URL in Email message navigates to a valid URL.
a1 = Instr(objFolderItems(i).Body,"https://")
a2 = Instr(objFolderItems(i).Body,"Click Here")
a3 = Len(objFolderItems(i).Body)
strLinkURL = Mid(objFolderItems(i).Body,a1,a2-1-a1)