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.

Keefer
  • 147

1 Answers1

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.

mischab1
  • 1,342