Hi,
I have a workbook with 7 worksheets in it. I am running the code below to save a copy of the worksheets that i want saved. However this isnt saving the modules for the worksheets, what code do i need to use to make it so that all the macros go with the new file?
Sub saveworkorderasseperatefile()
Dim sFileName As String
sFileName = "\\SHOP-3\Shop Files\Work Orders and Time Logs\Jobs in Progress\" & _
ActiveCell.Offset(0, -9).Value & " (" & Format(Date, "mm-dd-yy") & " " & ActiveCell.Offset(0, -4).Value & ")" & ".xlsm"
Sheets(Array("Work Order", "Time Log", "Time Log (Continuation Page)", "Label")).Copy 'specify the sheets accordingly
ActiveWorkbook.SaveAs Filename:=sFileName, FileFormat:=52 'xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close savechanges:=False
End Sub
I have a workbook with 7 worksheets in it. I am running the code below to save a copy of the worksheets that i want saved. However this isnt saving the modules for the worksheets, what code do i need to use to make it so that all the macros go with the new file?
Sub saveworkorderasseperatefile()
Dim sFileName As String
sFileName = "\\SHOP-3\Shop Files\Work Orders and Time Logs\Jobs in Progress\" & _
ActiveCell.Offset(0, -9).Value & " (" & Format(Date, "mm-dd-yy") & " " & ActiveCell.Offset(0, -4).Value & ")" & ".xlsm"
Sheets(Array("Work Order", "Time Log", "Time Log (Continuation Page)", "Label")).Copy 'specify the sheets accordingly
ActiveWorkbook.SaveAs Filename:=sFileName, FileFormat:=52 'xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close savechanges:=False
End Sub