Results 1 to 10 of 10

Save Single Sheet from multiple sheet workbook as MSDOS CSV format

Threaded View

  1. #1
    Registered User
    Join Date
    08-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    15

    Save Single Sheet from multiple sheet workbook as MSDOS CSV format

    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
    Attached Files Attached Files
    Last edited by BBen; 10-10-2012 at 03:38 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1