VBA Text Files
We can also read Excel File and write the contents of the cell into a Text File. This way, VBA allows users to work with text files. We can work with test files using two methods
-
File System Object
-
using Write Command
File System Object
using Write Command
Using File System Object(FSO)
As the name suggests, FSO Objects help the developers to work with drives, folders and files. In this section, we will discuss how to use FSO.
Object Type | Description |
---|---|
Drive | Drive is an Object. Contains methods and properties that allow you to gather information about a drive attached to the system |
Drives | Drives is a Collection. It Provides a list of the drives attached to the system, either physically or logically. |
File | File is an Object. It Contains methods and properties that allow developers to create, delete or move a file. |
Files | Files is a Collection. It Provides a list of all files contained within a folder. |
Folder | Folder is an Object. It Provides methods and properties that allow developers to create, delete or move folders. |
Folders | Folders is a Collection. It Provides a list of all the folders within a Folder. |
TextStream | TextStream is an Object. It enables developers to read and write text files. |
Drive
Drive is an object, which provides access to the properties of a particular disk drive or network share. The Following properties are supported by Driveobject:
-
AvailableSpace
-
DriveLetter
-
DriveType
-
FileSystem
-
FreeSpace
-
IsReady
-
Path
-
RootFolder
-
SerialNumber
-
ShareName
-
TotalSize
-
VolumeName
AvailableSpace
DriveLetter
DriveType
FileSystem
FreeSpace
IsReady
Path
RootFolder
SerialNumber
ShareName
TotalSize
VolumeName