Following script exports specific tabs in the workbook to one folder (Manual Backups) on a network. Looking for a way to export each tab to its own specific folder.
i.e. worksheet "Apples" in the array saves to folder "Apples" etc. Any suggestions are appreciated!
i.e. worksheet "Apples" in the array saves to folder "Apples" etc. Any suggestions are appreciated!
VBA Code:
Sub ExportWorksheetsToSpecificFolderTest()
Dim worksheet_list As Variant, worksheet_name As Variant
Dim new_workbook As Workbook
Dim saved_folder As String
worksheet_list = Array("Apples", "Oranges", "Bananas", "Grapes")
'// close the path with a back slash
saved_folder = "\\ABC-DC01\ABCComm\Common\District Data\Daily Report\Manual Backups\"
For Each worksheet_name In worksheet_list
On Error Resume Next
Set new_workbook = Workbooks.Add
ThisWorkbook.Worksheets(worksheet_name).Copy new_workbook.Worksheets(1)
new_workbook.SaveAs saved_folder & worksheet_name & " " & Format(Now(), "MM-DD-YY") & ".csv", 6
new_workbook.Close False
Next worksheet_name
MsgBox "Export complete.", vbInformation
End Sub