Skip to main content

Check if file exists

Validate if a file exists, send the file and path information and the function will return True if it exists else it returns False.

 

Snippet
'checks to see if a file exists, return True if it does
Function checkIfFileExists(sTempFile As String) As Boolean
	Dim oFSO As Object
	Set oFSO = CreateObject("Scripting.FileSystemObject")

	If oFSO.FileExists(sTempFile) Then
		checkIfFileExists = True
	Else
		checkIfFileExists = False
	End If

	Set oFSO = Nothing
End Function