This function takes a comma separated string and parses the values into a variable-length array, which can then be assigned to a predefined number of variables, or iterated with a For-Next loop. This code is roughly based on Brant Gluth's submission entitled "Parse Delimited Text", with the addition of a demo form and improved string handling. Most noticeably, this code can handle strings enclosed in quotes and will not break on delimiter characters within the quotes.
Inputs
strSource - string containing CSV text.
strDelimiter - optional string value representing the delimiter, default is a comma.
strQuote - optional string value representing the quotation mark character, default is ".
Assumes
All you need to implement this code in your own program is the module "readcsv.bas".
Returns
variable-length variant array containing each field from the CSV line.
Side Effects
None. Does not crash when given an empty string or improperly formatted text.