Forum Discussion

JonAstolfi's avatar
JonAstolfi
Copper Contributor
Sep 02, 2021

MS Excel Export CSV to Unique File

Is there a way to export from a multi-tabbed Excel workbook to a unique CSV file?

Currently I am https://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba , but this 'converts' the opened file.  I am seeking to export the active tab to CSV but still be active in the XLSX file.

5 Replies

  • Yea_So's avatar
    Yea_So
    Bronze Contributor
    search for vba code online to copy the sheet tab and save as csv
    • JonAstolfi's avatar
      JonAstolfi
      Copper Contributor
      Just realized that the name of the tab also changes to the name of the exported CSV file.
      Another reason for MS to advance this option.
  • DKoontz's avatar
    DKoontz
    Iron Contributor
    Saving Excel as different file types doesn't change the underlying data in anyway. If you use "save as" to save off a copy as a CSV file, you can then "save as" back to XLSX file and your workbook won't be effected in any way. A little clunky but I don't think excel has an export function built in unless you want to use create one using VBA.
    • JonAstolfi's avatar
      JonAstolfi
      Copper Contributor

      Hello DKoontz 

      The concern is not in relation to a change in the existing underlying data, but rather it changes the file type that affects continuing with new data/effort. 

       

      I'm seeking to find something better than the "clunky" process you've identified.

      Have you created anything in VBA for this?

      • DKoontz's avatar
        DKoontz
        Iron Contributor

        JonAstolfi 

        Saving as CVS then saving back to XLSX isn't too bad, but for VBA you would just need a macro that saved as CSV the saved back to XLSX.

         

        Something like this should work: just change where your workbook and export should go:

        ActiveWorkbook. SaveAs FileName:="C:\My Documents\MyCSV", FileFormat:=xlCSV
        ActiveWorkbook. SaveAs FileName:="C:\My Documents\MyXLXS", FileFormat:=xlOpenXMLWorkbook

         

Resources