I've been re-using some older code to automate reading in some email messages and reading them into a database.
The code I've used before has worked, as I've been able to define the start and end variables in each section of the email body as such:
So, I've been using the Msg.Body.IndexOf property to search for my keywords, that start and end each database table field.
well, now i've got a program and I can use this code for 99% of it - but the VERY last section of the email is a freeform text field that just ends at the end of the message. So I can start to read it by looking for the first variable, but have no end variable.
How would I read from the index point of the last variable to the end of the message body? I tried EoF and oMsg.Body.EoF and oMsg.Body.End to no avail.
Thanks!
The code I've used before has worked, as I've been able to define the start and end variables in each section of the email body as such:
Code:
iSEIloc1 = oMsg.Body.IndexOf("[VisitType]")
iSEIloc2 = oMsg.Body.IndexOf("[/VisitType]")
iSEILocDiff = iSEIloc2 - iSEIloc1
If iSEILocDiff > 0 Then
strSEIVisitType = oMsg.Body.Substring((iSEIloc1 + 11), (iSEILocDiff - 9)) 'adjusted for tag length
strSEIVisitType = strSEIVisitType.Remove(strSEIVisitType.Length - 1)
strSEIVisitType = strSEIVisitType.Substring(0, strSEIVisitType.Length - 1)
'MsgBox("Notification EquipModel is: " & strEquipModel)
Else
strSEIVisitType = ""
End Ifwell, now i've got a program and I can use this code for 99% of it - but the VERY last section of the email is a freeform text field that just ends at the end of the message. So I can start to read it by looking for the first variable, but have no end variable.
How would I read from the index point of the last variable to the end of the message body? I tried EoF and oMsg.Body.EoF and oMsg.Body.End to no avail.
Thanks!