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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Status
Not open for further replies.

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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