Joe4
MrExcel MVP, Junior Admin
- Joined
- Aug 1, 2002
- Messages
- 74,077
- Office Version
- 365
- Platform
- Windows
I am trying to create a "pass though editor" macro in Excel that our staff can use to edit certain CSV files. Basically, one of our software programs requires CSV files to be formatted a specific way. Among other things, every field must be surrounded by Text Qualifiers (double-quotes_.
The program that initially creates the CSV file formats all the fields exactly as they need to be, including putting text qualifiers around all fields. However, due to some data issues, sometimes our staff needs to manually change some of the data in the file. That is where this "pass through editor" macro I am creating comes in (sometimes the changes are too difficult to do in a text editor, and they need to see the data in columns).
The issue I have is this. In my macro that imports the CSV file into Excel, I can choose either to designate delimiters or not.
- If I designate the delimiters, then Excel drops all the demiliters when importing. So then in re-saving the file, only data that has commas in it are exported with delimiters (default Excel behavior).
- If I do not designate the delimiters upon import, then Excel treats my delimiters (double-quotes) as text and imports them. However, when re-saving the CSV file, it then triples up my delimiters (so wherever one double-quote appeared before, now three appear).
Obviously, neither of these two situations work, where I need to maintain a single set of delimiters around each and every field.
Does anyone know how I can accomplish this?
The program that initially creates the CSV file formats all the fields exactly as they need to be, including putting text qualifiers around all fields. However, due to some data issues, sometimes our staff needs to manually change some of the data in the file. That is where this "pass through editor" macro I am creating comes in (sometimes the changes are too difficult to do in a text editor, and they need to see the data in columns).
The issue I have is this. In my macro that imports the CSV file into Excel, I can choose either to designate delimiters or not.
- If I designate the delimiters, then Excel drops all the demiliters when importing. So then in re-saving the file, only data that has commas in it are exported with delimiters (default Excel behavior).
- If I do not designate the delimiters upon import, then Excel treats my delimiters (double-quotes) as text and imports them. However, when re-saving the CSV file, it then triples up my delimiters (so wherever one double-quote appeared before, now three appear).
Obviously, neither of these two situations work, where I need to maintain a single set of delimiters around each and every field.
Does anyone know how I can accomplish this?