Hi all - I currently have a macro that exports all "Sheets" to separate CSV's based on the sheet name (See Below for script). I would like to add a step prior to create a folder based on two cells with a "-" between such as C2-B2. The current script will create the exports within the same folder that the .XLSM file is located. I would like the script to create the new folder within parent folder where the workbook is located and then export the CSVs into that newly created folder. Also, I would like the script at the end to copy a file called "header.txt" from the parent folder into the newly created folder.
Oh I forgot - Is there any way to prevent the export script from exporting the first sheet only?
Any assistance is appreciated!!
Current Export Macro---
Code:Sub CSVExportTest2() Dim tmpWS As Worksheet Application.DisplayAlerts = False For Each WS In ThisWorkbook.Worksheets filePath = exportPath & "" & WS.Name & ".csv" WS.Copy Set tmpWS = ActiveSheet tmpWS.SaveAs Filename:=filePath, FileFormat:=xlCSV tmpWS.Parent.Close False Next End Sub




Reply With Quote
Bookmarks