How To keep Columns when Using a Macro to automatically save a .csv file

Status
Not open for further replies.

JonTTrier

New Member
Joined
Aug 28, 2012
Messages
3
I'm using a Macro that when activated saves a file as a .csv (MS-DOS) file. When saving it automatically it saves all information to Column A with a comma delimter. When you save the .csv (MS-DOS) file manually it prompts you with an "Error Message" . ".csv may contain features that are not compatible with CSV (MS-DOS). Do you want to keep the workbook in this format? When you click Yes the file is saved with all of the columns retained. This is what I want, but within a Macro.

*Plain and simple - Current Macro saves automatically as a .csv file with all data in column A seperated by commas (Correct I know)

Issue:
I used these .CSV (MS-DOS) files to import data into our ERP system, the ERP reads the information Column specific so the correct data has to be in the correct format. Only .CSV (MS-DOS) file can be imported.

**I'm wondering what about that "Error Message" Prompt and Clicking Yes retains all of the column locations within the .CSV File? And how can I get this to do the same in my VBA Code.

Any help is greatly appreciated - I've been stumped on this for a month now.

Code:

ActiveWorkbook.SaveAs Filename:= _
"C:\Users\jonathan.trier\Desktop\Destination Folder Adobe\" & "Adobe_CLC 5.0_North America_USD_" & Format(Date1, "YYYY_MM") & " CSV" & ".csv", FileFormat:= _
xlCSVMSDOS, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False


Thanks,

Jon
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Status
Not open for further replies.

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top