DebbieDavis
Programmer
Hi there, I am trying to delete a file like this:
It works great EXCEPT when the file isn't there... How do I see if it exists first? I've tried:
but it blows past it then I get an error because the file can't be found. Any ideas? Thanks very much.
dd
Code:
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObject = fso.GetFile("\\server\file.txt")
fileObject.Delete
It works great EXCEPT when the file isn't there... How do I see if it exists first? I've tried:
Code:
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObject = fso.GetFile("\\server\file.txt")
if fso.fileExists(fileobject) then
fileobject.delete
end if
but it blows past it then I get an error because the file can't be found. Any ideas? Thanks very much.
dd