Public Sub Delay(mmSec As Long)
On Error GoTo ShowError
Dim start As Single
start = Timer
While (Timer - start) < (mmSec / 1000#)
DoEvents
Wend
Exit Sub
ShowError:
MsgBox Err.Source & "------" & Err.Description
Exit Sub
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Me.Caption = "Your system will sleep 5 sec."
Sleep 5000
Me.Caption = ""
End Sub
Private Sub Form_Load()
Me.Caption = ""
Command1.Caption = "Sleep ..."
End Sub