Nuts - spoke too soon...I am trying to use this is Excel 2003
Sorry - my fault - this will work with Excel 2003 - I have place a button on your workbook and attached the macro - Changed your code so the active page after running the report is A-1 - you can change that back if you want.
Sub saveReportFile()
ChDir "Z:\FireOperations\Shift Reports\Unprocessed"
Sheets("ShiftSummary").Copy
fullFileName = Application.GetSaveAsFilename("DefaultFilename.xls", _
"Excel files (*.xls),*.xls", 1, "Save File As")
If fullFileName = False Then
MsgBox "File will not be saved"
Else
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=fullFileName, FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Application.DisplayAlerts = True
End If
End Sub
If you want to close the report automatically after saving just add in after the save a Close command.
ActiveWorkbook.SaveAs Filename:=fullFileName, FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close False ' This is the line to add if you want to automatically close the generated report after it is saved.
Application.DisplayAlerts = True
End If
End Sub
Bookmarks