PDA

View Full Version : can not be saved in a macro-free workbook



rjw29bs4
06-11-2017, 03:49 AM
can someone tell me whats wrong with this code
i keep getting a error saying
can not be saved in a macro-free workbook.
it was working fine a while ago



Sub copysave()
'copy invoice to a new workbook
ActiveSheet.copy
newfn = "k:\INVOICES BACKUP\ALL\" & Range("e4").Value & "." & Range("a10") & ".xlsx"
ActiveWorkbook.SaveAs newfn, FileFormat:=xlOpenXMLWorkbook
ActiveSheet.PrintOut
ActiveWorkbook.Close


'copy invoice to a new workbook
ActiveSheet.copy
newfn = "C:\Users\roger\Documents\aaa\" & Range("e4").Value & "." & Range("a10") & ".xlsx"
ActiveWorkbook.SaveAs newfn, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
Range("e4").Value = Range("e4").Value + 1
Range("a18:d30").ClearContents
Range("E3").ClearContents
Range("a10").ClearContents
ActiveWorkbook.Close
End Sub

mdmackillop
06-11-2017, 03:56 AM
If there are macros etc. in the workbook it needs to be saved as .xlsm