I have a template in which our workers can fill in the data, then the file should be saved as a new file with the Original macros from my template in it but that doesn't seem to work. The code is always removed in the new file. The template should be saved too because there's a numbering in it that has to go up with every new file created.
Does anybody know the solution?
Public Sub OpslBestand()
On Error Resume Next
Book1_BeforeSave
SavePdfEmail
Dim NieuwRet As Variant
ActiveWorkbook.Sheets.Copy
NieuwRet = "P:\Retourformulieren\Excel\" & Range("L2").Value & "-JL-" & Format(Date, "YYYYMMDD") & "-" & Range("Klant").Value
ActiveWorkbook.SaveAs NieuwRet, FileFormat:=xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close
VolgRet
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
Sheets.Copyit copies the sheets (and any macros in those sheets) to a new workbook, but won't copy any non-worksheet macros.