|
|
Часть строки между заданнами образцами текста (HTML тегами например)
Private Function GetMidStr(sString$, sStartBlock$, sEndBlock$) As Variant
Dim lStart&, sVal$
On Error GoTo GetMidStr_Err
lStart = InStr(1, sString, sStartBlock)
If lStart = 0 Then GoTo GetMidStr_End
lStart = lStart + Len(sStartBlock)
sVal = Mid(sString, lStart)
lStart = InStr(1, sVal, sEndBlock)
If lStart = 0 Then GoTo GetMidStr_End
sVal = Mid(sVal, 1, lStart - 1)
GetMidStr = Trim(sVal)
GetMidStr_End:
Exit Function
GetMidStr_Err:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in Function" & _
"GetMidStr - 00_Tests.", vbCritical, "Произошла ошибка!"
Err.Clear
Resume GetMidStr_End
End Function
|
|