|
-
August 2nd, 2001, 12:31 PM
#1
Check if file exists
Is there a good example of how to check if the file with a prticular name already exists.
Also it would be nice to find a good mechanism that automaticaly create a versioned file name like myfile_001 or myfile_002 if myfile and myfile_001 already exist.
Thank you!
-
August 2nd, 2001, 12:44 PM
#2
Re: Check if file exists
Here is a fairly simple method to detect if a file exists or not..
Dim fso
set fso = CreateObject("scripting.FileSystemObject")
If Not fso.FileExists("test.txt") then
msgbox "This file does not exist!"
End if
-
August 2nd, 2001, 02:50 PM
#3
Re: Check if file exists
An even simple would be:
if Dir(MyFile.txt)<>"" then... 'file exists!
----------
The @host is everywhere!
----------
-
August 2nd, 2001, 03:35 PM
#4
Re: Check if file exists
this is actualy better
FileName = Dir(path & SearchStr, vbNormal Or vbHidden Or vbSystem _
Or vbReadOnly)
thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|