Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Take a look here or here – Raystafarian Mar 29 '12 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 '12 at 20:03
up vote 1 down vote accepted

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.SaveAs sPath & sht.Name & ".txt", XlFileFormat.xlTextMac
   Next sht
   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.

share|improve this answer

You must log in to answer this question.

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