I have a function that I am using to get a string from between two substrings. The modification is that I need the function to have multiple stopping parameters. So if it finds any of the sStop strings it will work. Can anyone help me modify this function?
EDIT:
I'd also like to make it inclusive so that the start and end of the string are included in the output string.
Code:
Private Function GetBetween(ByVal sSearch As String, ByVal sStart As String, ByVal sStop As String, Optional ByVal lSearch As Integer = 1) As String
Dim lTemp As Long
lSearch = InStr(lSearch, sSearch, sStart)
If lSearch > 0 Then
lSearch = lSearch + Len(sStart)
lTemp = InStr(lSearch, sSearch, sStop)
If lTemp > lSearch Then Return Trim(Mid$(sSearch, lSearch, lTemp - lSearch))
End If
Return vbNullString
End FunctionI'd also like to make it inclusive so that the start and end of the string are included in the output string.