Hello, and thank you for the help. I have searched everywhere and cannot find the answer why this is not working.
I want to save Excel files in a pipe delimited CSV format. In my code, I have taken the steps that work when I do the same thing manually, but the code doesn’t work.
Manually saving, I do these steps:
In the Control Panel settings I changed the default Comma List Separator to a Pipe. I open an Excel file, do SaveAs: CSV (Comma delimited) (*csv), I get the standard dialog box warning:
filename.csv may contain features that are not compatible with CSV (Comma delimited). Do you want to keep the workbook in this format?
I answer Yes – I open the saved CSV file in notepad and the Pipe delimiters are there.
If I use code that completes the same steps (I believe), the pipe delimiter is not there, the commas are.
I use this code, that appears to be the same as the recorded steps that do work. Note myPath and myFileName are previously defined and work, the save routine works, but it only saves the comma delimiter.:
My understanding is when using Application.DisplayAlerts = False, it answers the dialog box as Yes.
So it appears that the code is doing the exact same thing as when the steps are completed manually, but the code doesn’t work the same.
Am I missing something.
Any help would be greatly appreciated.
Thank you.
I want to save Excel files in a pipe delimited CSV format. In my code, I have taken the steps that work when I do the same thing manually, but the code doesn’t work.
Manually saving, I do these steps:
In the Control Panel settings I changed the default Comma List Separator to a Pipe. I open an Excel file, do SaveAs: CSV (Comma delimited) (*csv), I get the standard dialog box warning:
filename.csv may contain features that are not compatible with CSV (Comma delimited). Do you want to keep the workbook in this format?
I answer Yes – I open the saved CSV file in notepad and the Pipe delimiters are there.
If I use code that completes the same steps (I believe), the pipe delimiter is not there, the commas are.
I use this code, that appears to be the same as the recorded steps that do work. Note myPath and myFileName are previously defined and work, the save routine works, but it only saves the comma delimiter.:
Code:
Application.DisplayAlerts = False
'Save as a csv file for import
ActiveWorkbook.SaveAs FileName:=myPath & myFileName & ".csv", ‘FileFormat:=xlCSV
Application.DisplayAlerts = True
My understanding is when using Application.DisplayAlerts = False, it answers the dialog box as Yes.
So it appears that the code is doing the exact same thing as when the steps are completed manually, but the code doesn’t work the same.
Am I missing something.
Any help would be greatly appreciated.
Thank you.
Last edited: