Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Responding to system shutdown

Is there an event that fires in Excel when the shutdown.exe -f is used
outside Excel to reboot the system?

I have an Excel application running and I would like the opportunity to save
the workbook before the system shuts down.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Responding to system shutdown

Unless you have a very old version of Windows/Office/Excel it should
automatically save your work in the event of system failure. It will give
you an option on restart for which file you want to save under the original
file name. I always check the data in both versions before I decide, just to
be sure.

"sr216viper" wrote:

Is there an event that fires in Excel when the shutdown.exe -f is used
outside Excel to reboot the system?

I have an Excel application running and I would like the opportunity to save
the workbook before the system shuts down.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Responding to system shutdown



"JLGWhiz" wrote:

Unless you have a very old version of Windows/Office/Excel it should
automatically save your work in the event of system failure. It will give
you an option on restart for which file you want to save under the original
file name. I always check the data in both versions before I decide, just to
be sure.

"sr216viper" wrote:

Is there an event that fires in Excel when the shutdown.exe -f is used
outside Excel to reboot the system?

I have an Excel application running and I would like the opportunity to save
the workbook before the system shuts down.


We are using Excel to gather data from some solar systems. So its not
something that a user is working with interactive. So I was looking for an
event that will fire when shutdown.exe -f is used to reboot the system. That
way I can put code in the event to save the current set of data.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Responding to system shutdown

I think the only way would be to create a UserForm to load on startup and
then examine the CloseMode in QueryClose to see if the application is being
shut down by Windows.

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
' 2 = Windows is shutting down
' 3 = Task Manager is killing the process
If (CloseMode = 2) Or (CloseMode = 3) Then
' your shutdown code
End If
End Sub

Note that the UserForm need not be visible. You can just Load it without
Showing it. E.g.,

Sub Workbook_Open()
Load frmMyForm
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"sr216viper" wrote in message
...


"JLGWhiz" wrote:

Unless you have a very old version of Windows/Office/Excel it should
automatically save your work in the event of system failure. It will
give
you an option on restart for which file you want to save under the
original
file name. I always check the data in both versions before I decide,
just to
be sure.

"sr216viper" wrote:

Is there an event that fires in Excel when the shutdown.exe -f is used
outside Excel to reboot the system?

I have an Excel application running and I would like the opportunity to
save
the workbook before the system shuts down.


We are using Excel to gather data from some solar systems. So its not
something that a user is working with interactive. So I was looking for
an
event that will fire when shutdown.exe -f is used to reboot the system.
That
way I can put code in the event to save the current set of data.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel shutdown MRR Excel Discussion (Misc queries) 0 July 20th 06 01:58 PM
When trying to save a document the system goes Not Responding Z Man Excel Discussion (Misc queries) 1 April 20th 06 11:33 PM
UPS Shutdown script clayton Excel Discussion (Misc queries) 2 December 13th 05 02:53 AM
Excel, VB.Net and shutdown Jay Nabonne Excel Programming 1 December 8th 04 08:56 PM
VBA to ShutDown PC Phil Greenwood Excel Programming 1 October 17th 03 09:11 AM


All times are GMT +1. The time now is 07:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"