+ Reply to Thread
Results 1 to 2 of 2

Pause code, wait for input, no input received, carry on with the code

  1. #1

    Pause code, wait for input, no input received, carry on with the code

    I am trying to schedule reports to rn in excel using the open event,
    but obviously might need to change the code, so when I run it I want it
    to pop a box and ask if it should run and give me 10-20 seconds to
    click no so I can amend the code.

    The idea is the workbook opens, pops a box asking if its OK to run with
    a count down preferably, run the code if it receives no input.

    I know about mode/modeless userforms and have tried using the "wait"
    command, but that doesnt let you stop the code using the button.

    Is there a do loop or a for next I can use and update a label on a form
    to tell me how long I have. Quite new to this.

    Any ideas gratefully received.

    Thanks john


  2. #2

    Re: Pause code, wait for input, no input received, carry on with the code

    Figured it out, just in case someone else needs it.

    Sub testwait()

    UserForm1.Show vbModeless

    TimedDelay 9

    MsgBox "wait over"

    End Sub


    Sub TimedDelay(sec As Single)
    Dim x As long
    x = Timer + sec

    Do While Timer < x
    nSec = Round(x - Timer, 0)
    UserForm1.Label3 = nSec
    DoEvents
    Loop
    End Sub

    Thanks John


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1