Does form containing a timer control need to have focus for timer to work?

Posted on 2008-11-13
Last Modified: 2013-11-05
Does form containing a timer control need to have focus for an enabled timer to work?
Question by:lee88
    LVL 20

    Accepted Solution

    No.  The form must be open, though.

    Also, please read about the DOEVENTS statement.
    Depending on MODAL type functions, you may need to include DOEVENT inside loops, etc, to ensure the 'other' processes continue to run.

    This can be tested by putting a STOP in the timer code and try running some of your other forms and routines.  If the timer is running, the STOP will occur - otherwise - add the DOEVENTS statement in your code and re-test.

    Scott C
    LVL 76

    Expert Comment

    Try this
    Private Sub Command1_Click()
    Timer1.Enabled = True
    Timer1.Interval = 1000
    End Sub
    Private Sub Timer1_Timer()
    End Sub

    Open in new window


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now