Dim pan As String Dim MyPath() As String = {"c:\","d:\","e:\","f:\","g:\","h:\"} Dim MyFolder As String For i As Integer = 0 To 5 try MyFolder = Dir(mypath(i) & "*.*", vbDirectory) If MyFolder <> "" Then pan = mypath(i)
End If Catch ex As Exception pan = mypath(i-1) End Try Next Output.Show(pan)