Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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.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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.