This example will load an array with directory entries unless there are more than ten entries-in which case, the Exit Do terminates the loop.
Const crlf = Chr$(13) + Chr$(10)
Sub Main()
????Dim a$(5)
????Do
????????i% = i% + 1
????????If i% = 1 Then
??????????a(i%) = Dir("*")
????????Else
??????????a(i%) = Dir
????????End If
????????If i% >= 5 Then Exit Do
????Loop While (a(i%) <> "")
????If i% = 5 Then
????????MsgBox i% & " directory entries processed!"
????Else
????????MsgBox "Less than " & i% & " entries processed!"
????End If
End Sub
|