Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

FileSystemObject in Excel Macro


The FileSystemobject act as an mediator for your code and computer’s system files. Once you create the object of FileSystemObject, using that object you can perform various operations on your computer like create creating folders, textfiles, reading them, deleting them etc.


Create object of FileSystemObject.

Dim fso As New FileSystemObject

Make sure the “Microsoft Scripting Rumtime” reference is added to your workbook (Excel). To know more about adding a reference library


If you doesn’t want to add library to your excel then use the full name ( refLibName.Object), its same as in java when you import a package you can directly use the classes inside the package else you have to use full class name which is packagename.classname.

Set fso = CreateObject(“Scripting.FileSystemObject”)

So here “Scripting” is a library name followed by “FileSystemObject”

Please check following methods of FileSystemObject

CopyFile Method
CopyFolder Method
CreateFolder Method
CreateTextFile Method
DeleteFile Method
DeleteFolder Method
DriveExists Method
FileExists Method
FolderExists Method
GetAbsolutePathName Method
GetDriveName Method
GetExtensionName Method
GetFile Method
GetFileVersion Method
GetFolder Method
GetParentFolderName Method
MoveFile Method
MoveFolder Method
OpenTextFile Method



You may also like...

Leave a Reply

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

%d bloggers like this: