7,763
社区成员
发帖
与我相关
我的任务
分享
Do
S = Dir$(Path01 & "\abc*", vbDirectory)
If (Len(S) = 11) Then
If (IsNumeric(Mid$(S, 4))) Then Exit Do
End If
S = Dir$()
Loop While (S > "")
Do
S = Dir$(Path01 & "\abc*", vbDirectory)'1位置,此处如果找不到abc*,则S=""
If (Len(S) = 11) Then
If (IsNumeric(Mid$(S, 4))) Then Exit Do
End If
S = Dir$()'这个位置是递归查找,如果1位置S="",则无法继续递归,所以就会报错。
Loop While (S > "")
'所以你的程序结构应如下改动:
s = Dir(path01 & "\abc*", vbDirectory)
Do While s <> ""
If (Len(S) = 11) Then
If (IsNumeric(Mid$(S, 4))) Then Exit Do
End If
s = Dir()
Loop
'你的错误与操作系统无关。
Do
S = Dir$(Path01 & "\abc*", vbDirectory)'1位置,此处如果找不到abc*,则S=""
If (Len(S) = 11) Then
If (IsNumeric(Mid$(S, 4))) Then Exit Do
End If
S = Dir$()'这个位置是递归查找,如果1位置S="",则无法继续递归,所以就会报错。
Loop While (S > "")
'所以你的程序结构应如下改动:
Dim s As String, path01 As String
path01 = "c:\windows"
s = Dir(path01 & "\abc*", vbDirectory)
Do While s <> ""
Debug.Print path01 & "\" & s
s = Dir()
Loop
'你的错误与操作系统无关。