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 FileSys­te­mob­ject act as an medi­a­tor for your code and computer’s sys­tem files. Once you cre­ate the object of FileSys­te­mOb­ject, using that object you can per­form var­i­ous oper­a­tions on your com­puter like cre­ate cre­at­ing fold­ers, textfiles, read­ing them, delet­ing them etc.

 

Cre­ate object of FileSys­te­mOb­ject.

Dim fso As New FileSystemObject

Make sure the “Microsoft Script­ing Rum­time” ref­er­ence is added to your work­book (Excel). To know more about adding a ref­er­ence library

OR

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 pack­age you can directly use the classes inside the pack­age else you have to use full class name which is packagename.classname.

Set fso = CreateObject(“Scripting.FileSystemObject”)

So here “Script­ing” is a library name fol­lowed by “FileSystemObject”

Please check fol­low­ing meth­ods of FileSys­te­mOb­ject

Copy­File Method
Copy­Folder Method
Cre­ate­Folder Method
Cre­ate­TextFile Method
Delete­File Method
Delete­Folder Method
Dri­ve­Ex­ists Method
File­Ex­ists Method
FolderEx­ists Method
GetAb­solutePath­Name Method
Get­Drive­Name Method
GetEx­ten­sion­Name Method
Get­File Method
Get­FileVer­sion Method
Get­Folder Method
Get­Par­ent­Fold­er­Name Method
Move­File Method
Move­Folder Method
Open­TextFile Method

 

 

You may also like...

Leave a Reply

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

%d bloggers like this: