For i = 1 To Len(Text1.Text) If InStr("123456789", Mid(Text1.Text, i, 1)) > 0 Then a = Left(Text1.Text, i - 1) Exit For End If Next
MsgBox a
Sub a() Dim i, str For i = 1 To Len(text1.text) str = Mid(text1.text, i, 1) If str Like "[0-9]" Then Exit For End If Next MsgBox Left(text1.text, i - 1) End Sub
str=mid(text1.text,i,1)
if (str>="0" and str<="9") then
exit for
endif
nextmsgbox left(text1.text,i-1)
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/
Dim i As Integer
Dim a As String
a = ""
For i = 1 To Len(Text1.Text)
If InStr("123456789", Mid(Text1.Text, i, 1)) > 0 Then
a = Left(Text1.Text, i - 1)
Exit For
End If
Next
MsgBox a
Dim i, str
For i = 1 To Len(text1.text)
str = Mid(text1.text, i, 1)
If str Like "[0-9]" Then
Exit For
End If
Next
MsgBox Left(text1.text, i - 1)
End Sub