Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings:
I wrote a macro (below) to save a workbook to two files and exit. If the paths are not available, the workbook should not be saved and Excel should simply quit. I think I may be misuing On Error Resume Next below, because the fact that the script is not finding the path is not causing an error. Any advice? Again, if the path is not found, I want Excel to simply exit (after restoring screenupdating and displayalerts). All changes are intended to be discarded if the script is unable to locate and save to the identified path. Thanks! --- Sub archive_and_exit() Application.ScreenUpdating = False Application.DisplayAlerts = False On Error Resume Next With ThisWorkbook .SaveAs Filename:="\\test\test1" & ".xlsb" .SaveAs Filename:="\\test\test2" & Format(Now, "mmm dd, yyyy - hhmm AM/PM") & ".xlsb" End With Application.Quit ActiveWorkbook.Close False Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save/exit macro | Excel Programming | |||
Excel Save as & Exit macro | Excel Programming | |||
running macro at save/close/exit | Excel Programming | |||
Write macro don't ask to save when exit excel | Excel Programming | |||
Macro: Exit active workbook without save? | Excel Worksheet Functions |