This is a simple function that I wrote that will return the text found between 2 strings.
You can call it like thisVB Code:
Public Function FindBetween(strContext As String, strStart As String, strEnd As String, Optional StartFrom As Long = 1) As String Dim strtPt As Long Dim ndPt As Long If StartFrom = 0 Then FindBetween = vbNullString Exit Function End If strtPt = InStr(StartFrom, strContext, strStart) + Len(strStart) ndPt = InStr(strtPt, strContext, strEnd) - strtPt If ndPt = -strtPt Then FindBetween = vbNullString Exit Function End If FindBetween = Trim$(Mid$(strContext, strtPt, ndPt)) End FunctionAnd Result will = "Hello!"VB Code:
Dim Context As String, Result As String Context = "<b>Hello!</b>" Result = FindBetween(Context, "<b>", "</b>") MsgBox Result




Reply With Quote