LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Timed closing code questions

Oh Wise Ones,

Heres a bit of code from Jim Thomlinson that saves and closes a workbook
after a set amount of time, but prompts the user for some more time. Works
great. I have 2 questions though.

1) If multiple people share a computer, will the Windows Script Host Object
Model flag be present for ALL people on that PC if it is set by the first
person?

2) I and not a programmer, but I would guess that the Windows Script Host
Object Model flag is set in the registry. Instead of running around to 30+
computers, can I package this in a reg file and email it out?


Sub Auto_Open()
Application.OnTime Now() + TimeValue("00:00:20"), "CloseMe"
End Sub

'requires reference to "Windows Script Host Object Model"
Public Sub CloseMe()
Dim SH As IWshRuntimeLibrary.WshShell
Dim Res As Long

Set SH = New IWshRuntimeLibrary.WshShell
Res = SH.Popup(Text:="Are you still there?", secondstowait:=2, _
Title:="Active", Type:=vbYesNo)
If Res = vbYes Then
Application.OnTime Now() + TimeValue("00:00:20"), "CloseMe"
Else
ThisWorkbook.Save
ThisWorkbook.Close
End If
End Sub

--
HTH...


 
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
2 Questions about the following code - Please help if you can. Chris Lewis[_2_] Excel Programming 0 January 4th 07 10:10 AM
Closing Workbook without Questions John Viall[_2_] Excel Programming 3 June 24th 06 08:00 PM
Closing Code Brian Matlack[_45_] Excel Programming 0 January 13th 06 08:39 PM
Closing the VBA Editor using code Bony_Pony Excel Worksheet Functions 1 March 7th 05 08:14 PM
[HELP] closing a program with VBA code Andr? Palmela Excel Programming 2 October 21st 04 05:47 PM


All times are GMT +1. The time now is 08:54 AM.

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"