Dim a As Long, b As Long, nStr As String
'得到以S開頭的兩個字符:
a = InStr(Text1.Text, "s")
If a > 0 Then
nStr = Mid(Text1.Text, 2)
MsgBox "以S開頭的兩個字符=" & nStr
End If
'得到d和h之間的字符:
a = InStr(Text1.Text, "d")
b = InStr(a + 1, Text1.Text, "h")
If a > 0 And b > 0 Then
nStr = Mid(Text1.Text, a + 1, b - a - 1)
MsgBox "d和h之間的字符=" & nStr
End If
End Sub