Place a command button on your worksheet and add the following code lines:. First, we declare a variable called myFile of type String, an object called rng of type Range, a variable called cellValue of type Variant, a variable called i of type Integer, and a variable called j of type Integer. We use a Variant variable here because a Variant variable can hold any type of value. Note: the DefaultFilePath property returns the default file path. To change the default file location, on the File tab, click Options, Save.
The FileSystemObject comprises several object collections and each of these object collections contains information about a specific aspect of the file system. These collections are:. Please note that FSO communicates with most of the above objects indirectly. In the below section we will see all the methods contained inside FileSystemObject. Finally, we have displayed the free space using a message box. Note that there are two properties to fetch the free space of a drive i.
Learn anything from creating dashboards to automating tasks with VBA code! Text files can be a very fast and simple way to read and store information. I like to use them to save settings for my VBA add-ins and I have seen situations where databases have exported large amounts of data into.
Logged in as Username. These techniques can have many useful applications. For instance if you have a list of data like a price or product list in Excel that you want to present in a formatted Word Document, these techniques can prove useful. In these examples, we assume the reader has at least basic knowledge of VBA, so we will not go over basics of creating and running scripts.