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