VBA FileSystemObject Methods Properties

VBA FileSystemObject Methods and Properties

VBA FileSystemObject Methods Properties List. The FileSystemObject provides an access to computer files, folders and drives. It represents a top level object also called as FSO in Excel VBA library. The FileSystemObject is not part of MS Office library. So when we are using FileSystemObject(FSO) in visual basic editor, we need to add it’s reference to working project. The reference of the FileSystemObject is Microsoft Scripting Runtime. In this FileSystemObject tutorial and guide explained with examples.

FileSystemObject Reference

You can click on the following button to learn more about FileSystemObject reference.

Create Microsoft Scripting Runtime Library Reference

FileSystemObject(FSO) Methods & Properties List

You can learn VBA FileSystemObject Methods and Properties list in Excel. There are several methods/functions and properties contains FileSystemObject.

Methods of FileSystemObject Object

Let us see the list of Methods of the FileSystemObject Object in Excel VBA.

Method Description
BuildPath VBA BuildPath method appends a name to an existing path and a file name or folder name and creates a new path.
CopyFile VBA CopyFile method copies one or more files from one location to another location.
CopyFolder VBA CopyFolder method copies one or more folders from one location to another location.
CreateFolder VBA CreateFolder method creates a new folder.
CreateTextFile VBA CreateTextFile method creates a text file and returns a textstream object that allows to read , or write to the file.
DeleteFile VBA DeleteFile method deletes one or more specified files.
DeleteFolder VBA DeleteFolder method deletes one or more specified folders and its sub folders and files.
DriveExists VBA DriveExists method returns True if a specified drive exists otherwise it returns False.
FileExists VBA FileExists method returns True if a specified file exists otherwise it returns False.
FolderExists VBA FolderExists method returns True if a specified folder exists otherwise it returns False.
GetAbsolutePathName VBA GetAbsolutePathName method returns a complete path from the root of the drive of the specified path to a file or folder.
GetBaseName VBA GetBaseName method returns the base name of a specified file or folder.
GetDrive VBA GetDrive method returns a drive object corresponding to the drive in a specified path.
GetDriveName VBA GetDriveName method returns the drive name of a specified path.
GetExtensionName VBA GetExtensionName method returns the file extension name for the last component in a specified path.
GetFile VBA GetFile method returns a file object corresponding to the file for a specified path.
GetFileName VBA GetFileName method returns the file name or folder name for the last component in a specified path.
GetFolder VBA GetFolder method returns a folder object corresponding to the directory for a specified path.
GetParentFolderName VBA GetParentFolderName method returns the name of the parent folder of the last component in a specified path.
GetSpecialFolder VBA GetSpecialFolder method returns the path to the special folder.
GetTempName VBA GetTempName method returns a randomly generated avilable temporary file or folder.
Move VBA Move method moves a specified file or folder from one location to another location.
MoveFile VBA MoveFile method moves one or more files from one location to another location.
MoveFolder VBA MoveFolder method moves one or more folders from one location to another location.
OpenAsTextStream VBA OpenAsTextStream method opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
OpenTextFile VBA OpenTextFile method opens a file and returns a TextStream object that can be used to access the file to read, write to, or append to the file.
WriteLine VBA WriteLine method writes a specified string and newline character to a TextStream file.

Properties of FileSystemObject Object

Let us learn the list of Properties of the FileSystemObject Object in Excel VBA.

Method Description
Drives VBA Drives Property returns a collection of all available drive objects on the computer.
Name VBA Name Property sets or returns the name of a specified file or folder.
Path VBA Path Property returns the path for a specified file, folder, or drive.
Size VBA Size Property returns the size in bytes of the specified file in all files, folders and subfolders contained in the folder .
Type VBA Type Property returns information about the type of a file or folder

Leave a Reply

Your email address will not be published. Required fields are marked *