|
楼主 |
发表于 2020-12-27 20:18
|
显示全部楼层
终于找到了答案
Function fExtractStr(ByVal strInString As String) As String
Dim lngLen As Long, strOut As String
Dim i As Long, strTmp As String, strInString1 As String, strTmp1 As String
strTmp1 = "1"
If InStr(strInString, "AB") = 0 Then
lngLen = Len(strInString)
Else
lngLen = Len(strInString) - (Len(strInString) - InStr(strInString, "AB")) - 9
End If
strOut = ""
For i = 1 To lngLen
strTmp = Left$(strInString, 1)
strInString = Right$(strInString, lngLen - i)
If (Asc(strTmp) >= 48 And Asc(strTmp) <= 57) Then
strOut = strOut & strTmp
End If
strTmp1 = strTmp
Next i
fExtractStr = strOut
End Function |
|