We recommend using Visual Studio 2017

Working with Files

With the advent of the Scripting Runtime object library, you can work with drives, folders, and files as objects.

In This Section

The Microsoft Scripting Runtime Object Library
Understand the Scripting Runtime Object Library, and learn how to set a reference to it.
Returning Files from the File System
Use the FileSystemObject to work with drives, folders, and files in the file system.
Setting File Attributes
Use the File object and Folder object to read or set file or folder attributes.
Logging Errors to a Text File
Use objects to write to a text file, return an object that refers to a new or existing file, and use methods to open it for input or output.
The Dictionary Object
Understand the features of the Dictionary object — the Exists method, the CompareMode property, the Key property, and the RemoveAll method.

Related Sections

Getting the Most Out of Visual Basic for Applications
Write code that is fast, efficient, easy to read and maintain, and, if possible, reusable with a solid working knowledge of Microsoft® Visual Basic® for Applications (VBA) — what features the language includes and what you can do with it.
Working with Strings
Understand how to get information from strings.
Working with Numbers
Learn how to use numeric values and data types in Microsoft® Visual Basic® for Applications (VBA).
Working with Dates and Times
Manipulate date values in Microsoft® Visual Basic® for Applications (VBA), and understand how VBA stores date values internally.
Understanding Arrays
Use arrays when you must store a number of values of the same type, but you do not want to create individual variables to store them all.
Tips for Defining Procedures in VBA
Define a Function or Sub procedure, and use the options available to you to make your code more extensible or more flexible.
Optimizing VBA Code
Understand how to streamline your Microsoft® Visual Basic® for Applications (VBA) code to streamline your memory requirements.
Show: