PDA

View Full Version : GetStringBetween Help



jojo
03-21-2012, 01:58 PM
So I want to get the DOB of my account, but there are like 10 things that have "</td><td>", "</td></tr>" Is there any way to tell it like (5, "</td><td>", "</td></tr>") so it would get the fifth one?

j03
03-21-2012, 02:03 PM
Think outside the box...

Grab a portion of the string that contains the birthdate, then do another getbetween grabbing the birthdate. ;)



Data = GetStringBetween(strHTML, "<b>Date of Birth</b><br>", "</td></tr>")
Data = Replace(Data, "</td><td>", "")

jojo
03-21-2012, 02:04 PM
Thank you so much! :)

Zachafer
03-21-2012, 04:44 PM
Public Function GetBirthday(strHTML As String) As String
Dim startIndex As Long
startIndex = InStr(1, strHTML, "<b>Date of Birth</b>")
If startIndex = 0 Then
GetBirthday = "Birthday not found"
Else
GetBirthday = Mid$(strHTML, startIndex + 35, 10)
End If
End FunctionIs the most reliable way...