Predmet:Re: Application.FileSearch
Na osnovu onoga sto si dao tebi treba da provjeris dali fajl postoji u nekom dir.
Ako sam u pravu evo rjesenje.
Ovu funkciju stavi u neki modul.
PreuzmiIzvorni kôd (Visual Basic):Function FileExists(Putanja As String, Optional ImeFajla As String) As Boolean
On Error GoTo Error_Handler
Dim Fajl As String, PathStr As String
If Right(Putanja, 1) = "/" Or Right(Putanja, 1) = "\" Then
PathStr = Putanja & ImeFajla
Else
PathStr = Putanja & "/" & ImeFajla
End If
If Dir(PathStr) <> "" Then
FileExists = True
Exit Function
End If
Error_Handler_Exit:
On Error Resume Next
FileExists = False
Exit Function
Error_Handler:
MsgBox "The following error has occured." & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: DirFajl" & vbCrLf & _
"Error Description: " & Err.Description, _
vbCritical, "An Error has Occured!"
Resume Error_Handler_Exit
End Function
funkciju pozivas:
Dim a as boolean
a=FileExists("d:/temp","SYS.MDW")
Vraca true ako ima a false ako nema fajla
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.