Dec 10 2019 09:30 AM
Greetings,
I have this simple VBA Macro that coverts all the files in a workbook to individual CSV files. However i would like to get the workbook name to be a a part of the directory . Also is for the code to be retro fitted so that i can convert all the workbooks in the directory.
Public Sub SaveWorksheetsAsCsv()
Dim xWs As Worksheet
Dim xDir As String
Dim folder As FileDialog
Set folder = Application.FileDialog(msoFileDialogFolderPicker)
If folder.Show <> -1 Then Exit Sub
xDir = folder.SelectedItems(1)
For Each xWs In Application.ActiveWorkbook.Worksheets
xWs.SaveAs xDir & "\" & xWs.Name, xlCSV
Next
End Sub
Cheers.