#1   Report Post  
Posted to microsoft.public.excel.misc
clayton
 
Posts: n/a
Default UPS Shutdown script


I just got a UPS for our computer that has the ability to run any
program/batch file/etc that can be executed from the command line when
the power goes out.

I want to somehow make a batch file or something that will be able to
execute the below code when the power goes out.
This is the same code that is normally executed by the user at the end
of the night by pressing a button.



Code:
--------------------

Sub SHUTDOWN_WIN()
If Worksheets.count 1 Then
unhideall
Call split_worksheet_to_workbook
End If
Application.DisplayAlerts = False
ActiveWorkbook.Save
Call Shell("c:\windows\system32\Shutdown.exe -s -t 0", 1)
ActiveWorkbook.Close

Application.DisplayAlerts = True
End Sub
--------------------


This code must somehow be executed from within the workbook itself as
it calls other functions. I don't know if this is possible or not but
it sure would be handy...


--
clayton
------------------------------------------------------------------------
clayton's Profile: http://www.excelforum.com/member.php...fo&userid=4563
View this thread: http://www.excelforum.com/showthread...hreadid=492816

  #2   Report Post  
Posted to microsoft.public.excel.misc
clayton
 
Posts: n/a
Default UPS Shutdown script


I was thinking about what I could do to make this work. What I came up
with is this. If the UPS executes a batch file that creates a file
named shutdown.txt then I could have my already open excel file check
for that file every 15 minutes or so and if it exists to execute my
shutdown code which would also delete the shutdown.txt file.

Any other suggestions would greatly be appreciated. :)


--
clayton
------------------------------------------------------------------------
clayton's Profile: http://www.excelforum.com/member.php...fo&userid=4563
View this thread: http://www.excelforum.com/showthread...hreadid=492816

  #3   Report Post  
Posted to microsoft.public.excel.misc
clayton
 
Posts: n/a
Default UPS Shutdown script


OK, this is my last post until someone replies I promise! LOL

I did the above and all is working! Except... If someone left the form
with the cursor blinking in a cell. Like if you were to double click on
a cell it lets you type into that cell. Well, if it is like that then
the script will not execute until you leave that cell.
I have tried having the script change to a different sheet with no
luck. I've even tried sendkeys but that doesn't work either...

Any suggestions for this problem? I should probably start a new
thread...


--
clayton
------------------------------------------------------------------------
clayton's Profile: http://www.excelforum.com/member.php...fo&userid=4563
View this thread: http://www.excelforum.com/showthread...hreadid=492816

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
need help righting script to sort rows alphabetically then seperate them to line up [email protected] Excel Worksheet Functions 0 November 15th 05 01:23 AM
VB Script error Anthony Excel Discussion (Misc queries) 2 July 13th 05 03:09 PM
OsCommerce - Easy Populate Script - CSV/TXT Conversion Problem. PriceTrim Excel Discussion (Misc queries) 3 July 5th 05 05:27 PM
VBA script help..Please !!!! Anthony Excel Discussion (Misc queries) 6 June 6th 05 01:40 PM
Using a VB Script for barcodes - new to this Jon Excel Discussion (Misc queries) 2 May 13th 05 02:42 PM


All times are GMT +1. The time now is 07:31 PM.

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

About Us

"It's about Microsoft Excel"