FileSystemObject.GetFolder Method (VB6) |
Syntax
oFileSysObj.GetFolder(FolderPath)
oFileSysObj
Use: Required
Data Type: FileSystemObject object
Any object variable returning a FileSystemObject object.
FolderPath
Use: Required
Data Type: String
A path to the required folder.
Return Value
A Folder object.
Description
Returns a reference to a Folder object.
Rules at a Glance
FolderPath can be an absolute or relative path.
If FolderPath is a share name or network path, GetFolder ensures that the drive or share exists as part of the process of creating the Folder object.
If any part of path can't be contacted or doesn't exist, an error occurs.
Programming Tips and Gotchas
You should first use GetAbsolutePathName to create the required path string.
If FolderPath includes a network drive or share, you could use the DriveExists method to confirm the required drive is available prior to calling the GetFolder method.
Since GetFolder requires that FolderPath is the path to a valid folder, you should call the FolderExists method to verify that FolderPath exists.
You must use the Set statement to assign the Folder object reference to a local object variable.
See Also
- Folders.Item Property
Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.