Hi,
How I can check if a file exists without using the A97 dir() function? I need to check the existence of a possible new file name while on a loop that already uses dir(). The task is to traverse an hierarchy of folders containing sub folders and files, renaming some.
I got the function bellow but don't how to make it work, may be it needs a reference which I couldn't find.
Function FileExistsFSO(sFile As String) As Boolean
Dim fs As FileSystemObject
FileExistsFSO = True
Set fs = CreateObject("Scripting.FileSystemObject"
If fs.FileExists(sFile) = False Then FileExistsFSO = False
Set fs = Nothing
End Function
Thanks
How I can check if a file exists without using the A97 dir() function? I need to check the existence of a possible new file name while on a loop that already uses dir(). The task is to traverse an hierarchy of folders containing sub folders and files, renaming some.
I got the function bellow but don't how to make it work, may be it needs a reference which I couldn't find.
Function FileExistsFSO(sFile As String) As Boolean
Dim fs As FileSystemObject
FileExistsFSO = True
Set fs = CreateObject("Scripting.FileSystemObject"

If fs.FileExists(sFile) = False Then FileExistsFSO = False
Set fs = Nothing
End Function
Thanks