View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MSweetG222 MSweetG222 is offline
external usenet poster
 
Posts: 158
Default Timed Message Box Issue

Hello,

I am using a variation of the code below (from
http://www.xldynamic.com/source/xld.xlFAQ0022.html).

My issue is: every once in a while, the message window is not on top (ie:
usually a user clicks another window). It seems that the popup timer stops
counting until the message window is back on top.

Question: Is there any way to keep the message window on top?

Example Code:
Private Const TM_TEXT As String = "Press OK or Cancel, or just wait to
timeout"
Private Const TM_TITLE As String = "Timed Msgbox Example"
Private Const TM_DURATION As Long = 5 'seconds
'-------------------------------------------------------------
Sub TimedMsgbox()
Dim WSH As Object
Set WSH = CreateObject("WScript.Shell")
Select Case WSH.Popup(TM_TEXT, TM_DURATION, TM_TITLE, vbOKCancel)
Case vbOK
MsgBox "You clicked OK"
Case vbCancel
MsgBox "You clicked Cancel"
Case -1
MsgBox "Timed out"
Case Else
End Select
End Sub
'---------------------------------------------------------------
Thank you for your help,

MSweetG222