1

Is it possible to bulk export multiple sheets in an Excel Document to separate tab-delimited text files? As it is, it only exports the active sheet. I've got a document with 850 sheets, all of which I'd like to get exported as tab-delimited.

2
  • Take a look here or here Mar 29, 2012 at 19:54
  • I should note I'm on OS X Excel 2008. THat one solution uses stuff with shell32.dll. We already gave that one a shot, but failed there.
    – Keefer
    Mar 29, 2012 at 20:03

1 Answer 1

1

Quick and simple would be something like this:

Public Sub ExportSheets(wbk As Workbook, sPath As String)
   Dim sht As Worksheet
   For Each sht In wbk.Worksheets
      sht.Select
      sht.SaveAs sPath & sht.Name & ".txt", XlFileFormat.xlTextMac
   Next sht
   wbk.Close
   MsgBox "Done exporting."
End Sub

On Windows, you would call this by typing ExportSheets ActiveWorkbook, "C:\Data\" in the immediate window.

Note I'm closing the workbook when done because the workbook is now the last saved text file and not the original workbook.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .