I am using following code which prompts the user for a folder to save a copy of the active workbook. The workbook I want to copy is in .xlsm format. I want to save the new workbook in an .xlxs format (which will remove the code). The code works fine if I am only saving one single sheet
DataWorkbook.Sheets(Array("Deposit_Detail")).Copy
. The issue is when I try to save two sheets. I tried using this in place of
DataWorkbook.Sheets(Array("Deposit_Detail"), Array("Deposit_Summary")).Copy
Full code as follows. I am basically trying to save both worksheets into one workbook. thanks
Sub Create_FilesFolders_Master()
Dim DataWorkbook As Workbook
Dim SaveFileName As String
Application.ScreenUpdating = False
' Prompt user to select a folder
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = "C:\Temp\" ' Default path
.Title = "Please Select a Folder to Save Report"
.ButtonName = "Select Folder"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count = 0 Then Exit Sub ' User clicked cancel
strFolder = .SelectedItems.Item(1) & "\"
End With
Set DataWorkbook = ActiveWorkbook
DataWorkbook.Sheets(Array("Deposit_Detail"), Array("Deposit_Summary")).Copy
SaveFileName = "SOFA Report"
ActiveWorkbook.SaveAs Filename:=strFolder & SaveFileName
ActiveWorkbook.Close
Application.ScreenUpdating = True
End Sub
Bookmarks