Show Userform After Idle

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Show Userform After Idle

Post by adam »

Hi anyone,

I'm trying to modify the code in the attached workbook so that it shows userform1 after 30 seconds of workbook inactivity.

But my code is not showing me the user form with the time limit.

I would be happy if any one could figure out the reason why my code is not working.

Any help on this would be kindly appreciated.

Thanks in advance.
You do not have the required permissions to view the files attached to this post.
Best Regards,
Adam

User avatar
StuartR
Administrator
Posts: 12605
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Show Userform After Idle

Post by StuartR »

I made some minor changes to your StartTimer code and it seems to work fine.

Code: Select all

Sub StartTimer()
    Do
        Start = Timer
        Do While Timer < Start + idleTime
            DoEvents
        Loop
        If Not isActive Then
            UserForm1.Show
        Else
            isActive = False
        End If
    Loop
End Sub
StuartR


User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Show Userform After Idle

Post by agibsonsw »

There was a coding error with the if statement. This works for me:

Code: Select all

Sub StartTimer()

Start = Timer
Do While Timer < Start + idleTime
DoEvents
Loop
If Not isActive Then
UserForm1.Show
Else
isActive = False
StartTimer
End If

End Sub
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Show Userform After Idle

Post by adam »

Thanks for the reply. I do really apppreciate your help. How could I enable the right click menu from the workbook. Meaning right now ,If I right click a cell I cannot click any function from the menu.

How could I avoid this?

Any help on this would be kindly appreciated.
Best Regards,
Adam

Rick Rothstein
Microsoft MVP
Posts: 87
Joined: 10 Mar 2011, 05:38
Status: Microsoft MVP
Location: New Jersey in the US

Re: Show Userform After Idle

Post by Rick Rothstein »

I have attached your workbook modified to activate a timer every 30 seconds from the last time the user made an entry or closed the UserForm.
You do not have the required permissions to view the files attached to this post.

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Show Userform After Idle

Post by adam »

Thanks for the help Rick Rothstein. That was what I was searching for.
Best Regards,
Adam