Event Form1.Button1.Click
Call TQ()
End Event
Sub TQ()
Dim text, numStr, numArray()
text = Form1.InputBox1.Text
Dim i, j, lenText
lenText = Len(text)
j = 0
For i = 1 To lenText
' 如果当前字符是数字
If Mid(text, i, 1) >= "0" And Mid(text, i, 1) <= "9" Then
numStr = ""
' 开始收集数字字符
While Mid(text, i, 1) >= "0" And Mid(text, i, 1) <= "9"
numStr = numStr & Mid(text, i, 1)
i = i + 1
Wend
' 将收集到的数字字符串转换为数字并存入数组
ReDim Preserve numArray(j)
numArray(j) = CLng(numStr)
j = j + 1
End If
Next
' 输出提取到的数字数组
For k = 0 To UBound(numArray)
TracePrint numArray(k)
Next
End Sub
报错死循环了,哪个大神告诉是哪里出问题了