Data Type: FileSystemObject object
A FileSystemObject object.
Data Type: String
A path and filename.
Returns a reference to a File object.
FilePath can be an absolute or
a relative path.
FilePath is a share name or
network path, GetFile ensures that the drive or share exists as
part of the process of creating the File object.
If any part of the path in
FilePath can’t be contacted or
doesn’t exist, an error occurs.
The object returned by GetFile is a File object, not a TextStream object. A File object isn’t an open file; the point of the File object is to perform methods such as copying or moving files and interrogating a file’s properties. Although you can’t write to or read from a File object, you can use the File object’s OpenAsTextStream method to obtain a TextStream object. You can also save yourself a step by calling the FileSystemObject object’s OpenTextFile method.
You should first use GetAbsolutePathName to create the
FilePath includes a network
drive or share, you could use the DriveExists method to confirm
that the required drive is available prior to calling the
Since GetFile generates an error if the file designated in
FilePath doesn’t exist, you should
call the FileExists method before calling GetFile.
You must use the
Set statement to ...