I have a macro which at the end of it running, I would like to save a XLSX (i.e. non-macro-enabled workbook) copy of the file and then close out of the workbook and excel. The reason I want to save an XLSX copy vs saving another XLSM is because I don't want anyone to have the ability to re-run the macro on copy of the workbook once it has been run. The code I am using works to save the XLSX file and close out of it but won't close out of the excel application itself. Looking for some help in figuring out what I'm doing wrong. The code I am using looks something like this:
Code: Select all
Application.ScreenUpdating = False
'Do some other stuff here
FilePath = "Z:\FolderName\"
FileName ="TestFileName - " & Format(Date,"MMDDYY") & ".xlsx"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FilePath & FileName, FileFormat:=
Application.ScrenUpdating = True
Application.DisplayAlerts = True
Workbooks(FileName).Close SaveChanges:=False
Application.Quit