Visual Basic 6 function "file_exists"

Go back

Below you'll find the source for the Visual Basic 6 function file_exists.

Attribute VB_Name = "modFileExists"
' This function is downloaded from:
' You may freely distribute this file but please leave all comments, including this one, in it.
' @Author Stefan Thoolen <>

Option Explicit

' This function checks if a file exists and returns true or false
' Same syntax as the PHP function 'file_exists'
' See also:
' @param    String  filename        The file to check for
' @return   Boolean                 Wether the file exist or not
' @author   Stefan Thoolen <>
Public Function file_exists(filename) As Boolean
    If Dir(filename, vbHidden Or vbReadOnly Or vbSystem Or vbArchive) <> "" Then file_exists = true
End Function