string1$ = "apples, pears # and bananas" string2$ = "pears;, " + chr$(34) + "apples ; " + chr$(34) + " an;d bananas" commentMarker$ = "; #" Print parse$(string2$, commentMarker$) End Function parse$(string$, commentMarker$) For i = 1 To Len(string$) charIn$ = Mid$(string$, i, 1) If charIn$ = Chr$(34) Then inQuotes = Not(inQuotes) End If If Instr(commentMarker$, charIn$) And (inQuotes = 0) Then Exit For next i parse$ = Left$(string$, (i - 1)) End Function