Detect if file exists?

D

DeadManWalking

Hi,

can anybody provide me sample code (vbscript) to check if a specific
file exists?
'Cause I need to add a file whose name will be entered in a form and
be completed by code (vbscript) ([filename].pdf)
The folder is known and always the same.
I just want to check if the file exists to prevent an error.



ANY help will be appreciated!

DMW
 
S

Scott M.

Dim x
Set x = createObject("Scripting.FileSystemObject")
if x.fileExists(fileName) then
....
end if

Set x = nothing
 
D

DeadManWalking

Many, many thanks for your help!!!


Scott M. said:
Dim x
Set x = createObject("Scripting.FileSystemObject")
if x.fileExists(fileName) then
....
end if

Set x = nothing




DeadManWalking said:
Hi,

can anybody provide me sample code (vbscript) to check if a specific
file exists?
'Cause I need to add a file whose name will be entered in a form and
be completed by code (vbscript) ([filename].pdf)
The folder is known and always the same.
I just want to check if the file exists to prevent an error.



ANY help will be appreciated!

DMW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top