Hi,
I'm using Excel 2013 on Windows 8.
As per the title of this thread, I want to save a workbook, wait for a few seconds, close the workbook, quit Excel & reboot my pc. I'm using the following macro which does not work because Windows refuses to shutdown saying that "cannot quit Excel".
Could you show me a macro that works? Thanks.
Interestingly, if I run this code on a small workbook, it works but not on a big workbook...
I'm using Excel 2013 on Windows 8.
As per the title of this thread, I want to save a workbook, wait for a few seconds, close the workbook, quit Excel & reboot my pc. I'm using the following macro which does not work because Windows refuses to shutdown saying that "cannot quit Excel".
Could you show me a macro that works? Thanks.
Code:
Sub shutdown()
ActiveWorkbook.Save
Application.Wait (Now + TimeValue("0:00:05"))
Application.DisplayAlerts = False
Application.Quit
Shell "C:\Windows\System32\shutdown.exe /r /t 0", vbHide 'reboot
End Sub
Interestingly, if I run this code on a small workbook, it works but not on a big workbook...