Results 1 to 2 of 2

Thread: Pausing a macro

  1. #1
    Join Date
    May 2011
    Posts
    7

    Unanswered: Pausing a macro

    I have set up a stopwatch in Excel using the code below (Please excuse the code - I am new so have been using various bits of code I have found on the internet)

    Public Sub startClock()

    Dim start

    start = Timer
    Do While stopped = False
    DoEvents
    Worksheets("ALL@1").Range("E3").Value = Int((Timer - start + 0.5) / 60 / 60)
    Worksheets("ALL@1").Range("F3").Value = Int((Timer - start + 0.5) / 60)
    Worksheets("ALL@1").Range("H3").Value = (Timer - start) Mod 60
    Worksheets("ALL@1").Range("I3").Value = (Timer - start + 0.5) - (Int(Timer - start + 0.5))
    Loop

    End Sub

    Private Sub cmdStart1_Click()
    startClock
    End Sub

    Private Sub cmdStop1_Click()
    stopped = True
    End Sub


    What I would like to do is add a "Pause" function.

    If anyone could help me with this it would be greatly recieved. Also please bear in mind I am very new to this and may need to put it in very simple terms.

  2. #2
    Join Date
    Jan 2009
    Location
    Kerala, India
    Posts
    183

    Pausing a macro

    If you are trying to pause the execution of the macro in the middle somewhere then insert a STOP statement on a separate line.
    www.MsAccessTips.com (Learn MS-Access Tips & Tricks)
    Learn Advanced MS-Access Programming with sample VBA Code.

    All responses are based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •