Hi,
I have the following code for reading and searching for string in saved .msg files:
Set ol = CreateObject("Outlook.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
Dim strSearchFor
strSearchFor = "Ex date:"
For Each f In fso.GetFolder("\Test mail").Files
If LCase(fso.GetExtensionName(f)) = "msg" Then
Set msg = ol.CreateItemFromTemplate(f.Path)
If InStr(msg.Body, strSearchFor) <> 0 then
RETRIEVE TEXT AFTER strSearchFor
End If
Else
End If
Next
The code works fine finding the strSearchFor. However, I want to retrieve the following text after that is on the same row.
Example
Ex date: 06/30/2017
I want the code to return the date.
Any help is appreaciated.
I have the following code for reading and searching for string in saved .msg files:
Set ol = CreateObject("Outlook.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
Dim strSearchFor
strSearchFor = "Ex date:"
For Each f In fso.GetFolder("\Test mail").Files
If LCase(fso.GetExtensionName(f)) = "msg" Then
Set msg = ol.CreateItemFromTemplate(f.Path)
If InStr(msg.Body, strSearchFor) <> 0 then
RETRIEVE TEXT AFTER strSearchFor
End If
Else
End If
Next
The code works fine finding the strSearchFor. However, I want to retrieve the following text after that is on the same row.
Example
Ex date: 06/30/2017
I want the code to return the date.
Any help is appreaciated.