I would like save my worksheets from a workbook as separate csv-files, although with a custom extension.
This is the result I am looking for:
Sheet1.xyz Sheet2.xyz etc
With the code below I can save all sheets as csv-files:
Public Sub SaveWorksheetsAsCsv() Dim WS As Excel.Worksheet Dim SaveToDirectory As String SaveToDirectory = "D:\test\" For Each WS In ThisWorkbook.Worksheets WS.SaveAs SaveToDirectory & WS.Name, xlCSV Next End Sub
In the post below an Excel workbook is saved with a custom extension:
Save as different file type
How can I combine these in order to save the worksheets as csv- (or text-) files with a custom extension "xyz" ?
Thanks a lot!