Chapter 5. Parsing Data

When working with data in a database, you tend to take for granted the structured nature of the data. Well-designed databases have schema that provide for granular storage of data. Well-designed relational databases are normalized so that duplicate data is minimized.

But lots of times, you need to work with less structured data that exists in external files of various formats, or that may exist in poorly designed databases that are not sufficiently granular. You often need to extract bits and pieces of data locked away in these files and scary databases. This chapter is all about how to work with this less structured data.

In this chapter, you learn how to do the following:

  • Read data from and write data to external text files

  • Split data apart and combine it together

  • Use the VBA string handling functions to isolate data within strings

  • Perform token replacements within strings

  • Identify strategies for splitting up complex items into their component parts

  • Create HTML files from code

File Input/Output

We've looked at countless examples of working with data contained in tables in a Jet or ACE database, but it's almost as easy to work with data contained in many text files. VBA provides many statements designed specifically to provide access to data files stored on your computer or network.

In this section, you look at a couple of different ways to access data stored in text files.

Using VBA I/O statements

VBA provides 29 different statements to help you work with data files ...

Get Expert Access™ 2007 Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.