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:
' http://www.stefanthoolen.nl/archive/vb6-functions/
' 
' You may freely distribute this file but please leave all comments, including this one, in it.
' 
' @Author Stefan Thoolen <mail@stefanthoolen.nl>

Option Explicit

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