没法测试 只给你思路 自己去测试 Dim i&, j&, FolderName$, PicName$ Private Sub Command1_Click() List1.Clear: List2.Clear For i = 0 To 10 FolderName = "d:\" & CStr(i) & "\" If Dir(FolderName, vbDirectory) = "" Then 'List2.AddItem FolderName & " 文件夹不存在" Else aa = "" For j = 0 To 10 PicName = FolderName & CStr(j) & ".jpg" If Dir(PicName) = "" Then List2.AddItem PicName Else List1.AddItem PicName End If Next j End If Next i End Sub
Dim i&, j&, FolderName$, PicName$
Private Sub Command1_Click()
List1.Clear: List2.Clear
For i = 0 To 10
FolderName = "d:\" & CStr(i) & "\"
If Dir(FolderName, vbDirectory) = "" Then
'List2.AddItem FolderName & " 文件夹不存在"
Else
aa = ""
For j = 0 To 10
PicName = FolderName & CStr(j) & ".jpg"
If Dir(PicName) = "" Then
List2.AddItem PicName
Else
List1.AddItem PicName
End If
Next j
End If
Next i
End Sub