07-16-2009, 09:08 AM
Hi,
The answer for you first question is Yes. We can verify whether a folder or a file exists using fso object
FolderExists Method:
FileExists Method:-
-Mr.K
The answer for you first question is Yes. We can verify whether a folder or a file exists using fso object
FolderExists Method:
Code:
Returns True if a specified folder exists; False if it does not.
Dim fso, msg, fldr
fldr = "C:\Windows"
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(fldr)) Then
msg = fldr & " exists."
Else
msg = fldr & " doesn't exist."
End If
FileExists Method:-
Code:
Returns True if a specified file exists; False if it does not.
The following example illustrates the use of the FileExists method.
Dim fso, msg, filespec
filespec = "C:\boot.ini"
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(filespec)) Then
msg = filespec & " exists."
Else
msg = filespec & " doesn't exist."
End If
-Mr.K