IN THIS CHAPTER
In this chapter, I describe how to use Visual Basic for Applications (VBA) to perform common file operations and work directly with text files.
♦ A basic overview of VBA text file manipulation features
♦ Performing common file operations with both traditional techniques and the FileSearch object
♦ Various ways to open a text file
♦ Examples of reading and writing a text file with VBA
♦ Code to import more than 256 columns of data into a workbook
♦ Sample code for exporting a range to HTML format
Many applications that you develop for Excel require working with external files. For example, you might need to get a listing of files in a directory, delete files, rename files, and so on. Excel, of course, can import and export several types of text files. In many cases, however, Excel's built-in text file handling isn't sufficient. For example, you might need to import a text file that contains more than 256 columns of data. Or you might want to export a range of cells to a simple HyperText Markup Language (HTML) or extensible Markup Language (XML) file.
Was this article helpful?