25/02/08 17:30
LuigiBiasi
in definitiva il codice dovrebbe essere cosi:
Dim c As New FileSystemObject Dim dirve(10) As String Private Sub Form_Load() d = getfile("C:\", "prova.txt") End Sub Public Function getfile(path As String, filename As String) As Boolean Dim f As Folder Set f = c.GetFolder(path) Dim file(100) As String Dim directory(100) As String Dim i As Integer Dim tr As Boolean Dim o() As String tr = False i = 0 For Each Folder In f.SubFolders directory(i) = Folder i = i + 1 Next i = 0 For Each Files In f.Files o = Split(Files, "\") file(i) = o(UBound(o)) i = i + 1 Next For i = 0 To UBound(file) If (file(i) = filename) Then 'fai quello che vuoi tr = True Exit Function End If Next i If tr = False Then 'ha continuato il For non ha trovato il file For i = 0 To UBound(directory) If (directory(i) = "") Then Exit Function End If getfile directory(i), filename Next i Else getfile = True 'esci dalla funzione positivamente Exit Function End If End Function Function getdrive(drive As String) As Boolean If (c.DriveExists(drive)) Then 'il drive esiste getdrive = True End If getdrive = False End Function
Ultima modifica effettuata da LuigiBiasi 25/02/08 17:40
aaa