We are trying to process a CSV file into an Access table where the first line contains an instruction code "sep=^" (quotation marks only shown here to distinguish the text found in the first line; they are not contained in the file) that presumably indicates that the separator between fields is a carrot (^). If it is left in, the rest of the import routine does not process correctly. If this line is removed, the first line of the CSV file is a typical field name header row, which the routine is looking for.
Currently, we have to manually open the CSV in Notepad (or similar), delete the first line, and then resave the file before running our Access VBA import routine. We would like to eliminate this manual process and incorporate it directly into our VBA import processing routines. OR, if possible, to be able to skip over this line and start processing with the second line being treated as if it were the first line of the file containing the "header row" information. But, because we are not sure that ALL files will contain this first row separator instruction, an evaluation must be performed.
We are looking for how to add in a subroutine to evaluate the CSV file after opening it to determine if this first line contains "sep=^" ( again, the text in the file does not include the quotation marks). This will be the first text in the first line of the file, if it exists.
But, if the file does not contain this "delimiter specification" line (for example, the file has already been manually edited), we want to skip the process to delete the line (since that step is no longer required) and continue to the data import processing.
So,
if "sep=^" exists, we want to delete the entire line (row) in the file.
If not, proceed with the rest of the import routine.
This doesn't seem that this should be so difficult, but we are at a loss as to how to build this into the process. In searches, I have not found anything that references this type of situation with processing a CSV or text file. Looking for some assistance. Thanks!
Currently, we have to manually open the CSV in Notepad (or similar), delete the first line, and then resave the file before running our Access VBA import routine. We would like to eliminate this manual process and incorporate it directly into our VBA import processing routines. OR, if possible, to be able to skip over this line and start processing with the second line being treated as if it were the first line of the file containing the "header row" information. But, because we are not sure that ALL files will contain this first row separator instruction, an evaluation must be performed.
We are looking for how to add in a subroutine to evaluate the CSV file after opening it to determine if this first line contains "sep=^" ( again, the text in the file does not include the quotation marks). This will be the first text in the first line of the file, if it exists.
But, if the file does not contain this "delimiter specification" line (for example, the file has already been manually edited), we want to skip the process to delete the line (since that step is no longer required) and continue to the data import processing.
So,
if "sep=^" exists, we want to delete the entire line (row) in the file.
If not, proceed with the rest of the import routine.
This doesn't seem that this should be so difficult, but we are at a loss as to how to build this into the process. In searches, I have not found anything that references this type of situation with processing a CSV or text file. Looking for some assistance. Thanks!