Hi,
I'm trying to modify the following code so that it would show up the user form when the workbook is idle for 30 secs.
But I'm failing to so. Meaning I cant open my user form after 30 secs of idle.
Any help to overcome this would be kindly appreciated.
Here is the code on ThisWorkbook module
And following is the code on standard module
Thanks in advance.
I'm trying to modify the following code so that it would show up the user form when the workbook is idle for 30 secs.
But I'm failing to so. Meaning I cant open my user form after 30 secs of idle.
Any help to overcome this would be kindly appreciated.
Here is the code on ThisWorkbook module
Code:
Private Sub Workbook_Open()
Module1.isActive = True
StartTimer
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Module1.isActive = True
StartTimer
End Sub
Code:
Const idleTime = 30 'seconds
Public isActive As Boolean
Dim Start
Sub StartTimer()
Start = Timer
Do While Timer < Start + idleTime
DoEvents
Loop
If Not isActive Then
UserForm1.Show
Else
isActive = False
StartTimer
End If
Else
isActive = False
StartTimer
End If
End Sub