Open userform for after 30 secs idle

adamsm

Active Member
Joined
Apr 20, 2010
Messages
444
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
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
And following is the code on standard module
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
Thanks in advance.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,224,616
Messages
6,179,911
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top