CSV File Reading Class (Access Fields by Name)

Category:
Files and Directories
Type:
Classes
Difficulty:
Intermediate

Author: Anonymous

Version Compatibility: Visual Basic 6

More information:
This is a modified version of http://www.freevbcode.com/ShowCode.asp?ID=7626 which can access data by coloumn name. This class handles retrieving elements from a CSV file and requires a reference to the MS Scripting Runtime. Create an instance of the class, set the fieldSeparator and fieldName properties and loop through the file using the loadNextLine and getField functions. See comments for usage details.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: