Detect if file exists?

  • Thread starter Thread starter DeadManWalking
  • Start date Start date
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
 
Dim x
Set x = createObject("Scripting.FileSystemObject")
if x.fileExists(fileName) then
....
end if

Set x = nothing
 
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
 
Back
Top