Thread: Close a MsgBox
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Close a MsgBox

Taffy,

you can have it on the same line, just put a stement separator in, a colon

Case vbOK : Call ShutDown

--

HTH

RP

"Taffy" wrote in message
o.uk...
Bob,

Got it, had call on the same line as case

Case vbOK
Call ShutDown
Case vbCancel
Call SetTime
Case -1
Call ShutDown

Now it works

Thanks Taffy

"Taffy" wrote in message
o.uk...
Bob,
How do I call shutdown code, vba keeps shouting at me that I'm doing it
wrong:o)

Taffy Thanks


Dim DownTime As Date

Sub SetTime()
DownTime = Now + TimeValue("00:00:10") 'change time as needed
Application.OnTime DownTime, "timedmsg"
End Sub

Sub timedmsg()
Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
cTime = 10 ' 10 secs
Select Case WSH.Popup("Excel closing", cTime, "Question", _
vbOKCancel)
Case vbOK 'Call Shudown
Case vbCancel 'Call Disable
Case -1 'call Shutdown

Case Else
End Select

End Sub

Sub ShutDown()
ThisWorkbook.Save
ThisWorkbook.Close
End Sub

Sub Disable()
On Error Resume Next
Application.OnTime EarliestTime:=DownTime, Procedu="ShutDown",
Schedule:=False
End Sub





"Bob Phillips" wrote in message
...
Just call the shutdown code for Case vbOK, where I use MsgBox "You

clicked
OK"

--

HTH