I'm very new to VBA and am trying to teach myself through this forum. I'm learning a lot. Unfortunately, I'm stuck on this one. I have a large workbook with multiple sheets. I need a macro to save one of the sheets (ITEMIMPORT) as a new MSDOS CSV format. That file will be used to import data into my company's ERP software & the format has to be MSDOS CSV or the import will not map. I found a script and modified it to come close to what I need but the format is not correct. I get errors when I try to use the file it creates to import into our ERP. I've verified the data is fine by creating a csv file manually and importing into our ERP with the exact same data. That tells me it must be the format created by my script. Below is the script I'm using and attached is an example of my workbook. I appreciate any guidance you can provide!!! Hopefully I learn enough to give back at some point. Best regards...Brett
Here's the script:
Sub Create_ITEM_CSV()
Dim wks As Worksheet
Dim newWks As Worksheet
Set wks = Worksheets("ITEMIMPORT")
wks.Copy 'to a new workbook
Set newWks = ActiveSheet
With newWks
Application.DisplayAlerts = False
.Parent.SaveAs Filename:="C:\CP_IMPORTS\" & .Name & ".csv", _
FileFormat:=xlCSVMSDOS
Application.DisplayAlerts = True
.Parent.Close savechanges:=False
End With
End Sub
Bookmarks