fso.FileExists is too fussy
If that ever works, then it must because you have a file with that name - it
doesn't work for a folder (at least not in Win 2000). You need to use
FolderExists to check for a folder:
Sub Tester1()
Dim fso As Object, PathName As String
Set fso = CreateObject("Scripting.FileSystemObject")
PathName = "c:\data\"
If fso.FolderExists(PathName) Then
MsgBox PathName & " exists"
Else
MsgBox PathName & " does not exist"
End If
End Sub
and that isn't case sensitive.
--
Regards,
Tom Ogilvy
"Nick" wrote in message
...
I have this code...
Dim fso As Object, PathName as string
Set fso = CreateObject("Scripting.FileSystemObject")
PathName = c:\blahblah
If fso.FileExists(PathName) Then
Do this and that
This usally works a treat except that when the pathname
specified has a case change.
For example
If c:\Hello.doc exists
and I set PathName = c:\hello.doc
then the fso.FileExists function returns false.
Can anyone think of a workaround for this?
Thanks in advance for any answers
Nick Shinkins
|