I am importing the body of emails and am taking specific strings from the email and placing them in fields on a form. For text that i am capturing that is only one row it is not a problem. the problem is if the data i need to import is on multiple rows. i have tried this code:
- Dim rowOffset As Long
-
-
If InStr(1, abody(j), "Extent of Work:", 1) Then
-
strExtWork = Mid(abody(j), InStr(abody(j), "Extent of Work:") + 16)
-
-
-
rowOffset = 1 ' reinit
-
While Left(abody(j + rowOffset), 8) <> "Remarks:" ' check if this is Remarks:
-
strExtWork = strExtWork & abody(j + rowOffset)
-
rowOffset = rowOffset + 1
-
Me.ExtentofWork = Trim(strExtWork)
-
Wend
-
End If
As the end point will always be the word "Remarks:". This works for capturing multiple rows of text but if there is just a single row it does not capture that.
To summarize, I am trying to capture all text between the words "Extent of Work:" and "Remarks"
The problem is I can either capture one row, or multiple, with the codes provided, but not but situations.