Function CheckFileFolderExists(strName, fFile) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") CheckFileFolderExists = False If fFile = True Then ' It's a file If fso.FileExists(strName) = True Then CheckFileFolderExists = True Exit Function End If Else ' It's a folder/directory If fso.FolderExists(strName) = True Then CheckFileFolderExists = True Exit Function End If End If Set fso = Nothing End Function