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.

Read more