Getting Information about your Drives
As you have no doubt discovered as you carefully analysed the Scripting library in the Object Browser, there are far more items listed than just the TextStream class and the OpenTextFile method. Using the FileSystemObject you can retrieve a wealth of information about the current computer, including information about available drives, folders and files.
You may on occasion need to display a list of drives the current computer user has access to, so that you can store information about the location of various files used within your database. This is very easy using the Drives property of the FileSystemObject.
Dim fso As New Scripting.FileSystemObject
Dim drvs As Scripting.Drives
Dim drv As Scripting.Drive
Set drvs = fso.Drives
For Each drv In drvs
Debug.Print drv.DriveLetter & " " & drv.ShareName
Next
You will notice that there is a myriad of properties that you can discover about each Drive, including AvailableSpace and FileSystem, such as FAT and NTSC. Try a few out in the Debug line for the example above and then impress you friends!
Other Topics about Using the FileSystemObject
Getting Information About Your Folders
Getting Information About Your Files
Working with Text Files
Reading from Text Files
|