Skip to main content

Check if a file exists

Short function that checks if a file exists, good for checking that a file or rdf file exists.  
Returns true if the files exists else it returns false.
The function expects the name of the file along with the path information.

Snippet
'checks if a file exists, good for checking that a file or rdf file exists.  
'Returns true if the files exists else it returns false
'The function expects the name of the file along with the path information.
Function checkIfFileExists(sTempFilename As String) As Boolean
	Dim oFSO As obejct
	Set oFSO = CreateObject("Scripting.FileSystemObject")
	If oFSO.FileExists(sTempFilename) Then
		checkIfFileExists = True
	Else
		checkIfFileExists = False
	End If
End Function