Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Force a Message Box to close unanswered


Hi,

One of the spreadsheets we have has the problem that it keeps being
left open, I therefore want it to close after a set time, but if their
is someone working on the spreadsheet I would like it to ask them to
press OK to keep it open before it closes.
However once the question is asked it just hangs there until OK is
pressed.
I would like it to close if the question hasn't been answered (OK
pressed) in about 30 seconds.
Does anyone know how to do this?

This is the code I am using at the moment:



Private Sub Counter()
THE_COUNT = THE_COUNT + 1

If THE_COUNT 5 Then
Debug.Print "The Time is: " & Now()
Debug.Print "Count is: " & THE_COUNT
Debug.Print "Ending"

Dim Response As Variant
Response = MsgBox("Click OK to keep open", vbExclamation +
vbOKOnly, "Closing")

If Response = vbOK Then
THE_COUNT = 1
Call Application.OnTime(Now() + TimeValue("00:01:00"),
"Counter")
Else
' Want it to carry on and close if the message hasn't been
answered in 30 secs
Call Workbooks("CloseOnTime.xls").Close(True)
End If


ElseIf THE_COUNT = 0 Then
Debug.Print "The Time is: " & Now()
Debug.Print "Count is: " & THE_COUNT
Debug.Print "Ending 0"
Exit Sub

Else
Debug.Print "The Time is: " & Now()
Debug.Print "Count is: " & THE_COUNT
Call Application.OnTime(Now() + TimeValue("00:01:00"), "Counter")
End If

End Sub


Thanks for your help
Jennie


--
jennie
------------------------------------------------------------------------
jennie's Profile: http://www.excelforum.com/member.php...fo&userid=6706
View this thread: http://www.excelforum.com/showthread...hreadid=475326

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Force a Message Box to close unanswered

Hi Jennie,

See Chip Pearson's Timed Msgbox post:

http://tinyurl.com/c36y8

---
Regards,
Norman



"jennie" wrote in
message ...

Hi,

One of the spreadsheets we have has the problem that it keeps being
left open, I therefore want it to close after a set time, but if their
is someone working on the spreadsheet I would like it to ask them to
press OK to keep it open before it closes.
However once the question is asked it just hangs there until OK is
pressed.
I would like it to close if the question hasn't been answered (OK
pressed) in about 30 seconds.
Does anyone know how to do this?

This is the code I am using at the moment:



Private Sub Counter()
THE_COUNT = THE_COUNT + 1

If THE_COUNT 5 Then
Debug.Print "The Time is: " & Now()
Debug.Print "Count is: " & THE_COUNT
Debug.Print "Ending"

Dim Response As Variant
Response = MsgBox("Click OK to keep open", vbExclamation +
vbOKOnly, "Closing")

If Response = vbOK Then
THE_COUNT = 1
Call Application.OnTime(Now() + TimeValue("00:01:00"),
"Counter")
Else
' Want it to carry on and close if the message hasn't been
answered in 30 secs
Call Workbooks("CloseOnTime.xls").Close(True)
End If


ElseIf THE_COUNT = 0 Then
Debug.Print "The Time is: " & Now()
Debug.Print "Count is: " & THE_COUNT
Debug.Print "Ending 0"
Exit Sub

Else
Debug.Print "The Time is: " & Now()
Debug.Print "Count is: " & THE_COUNT
Call Application.OnTime(Now() + TimeValue("00:01:00"), "Counter")
End If

End Sub


Thanks for your help
Jennie


--
jennie
------------------------------------------------------------------------
jennie's Profile:
http://www.excelforum.com/member.php...fo&userid=6706
View this thread: http://www.excelforum.com/showthread...hreadid=475326



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
Unanswered NonConsecutive X Axis RayportingMonkey Charts and Charting in Excel 3 September 3rd 07 07:02 PM
How do you force excel to save on close Tom Hewitt Excel Discussion (Misc queries) 3 September 21st 06 10:55 AM
Is there a way to force Excel to close workbooks independently? Cam Excel Discussion (Misc queries) 4 February 2nd 06 07:43 PM
Close a message box Nigel Excel Programming 1 September 15th 05 12:49 AM
Macro to force Excel to close after a given timeframe of inactivit bobm Excel Programming 2 August 12th 05 02:41 AM


All times are GMT +1. The time now is 11:44 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"