Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: pausing a macro for user to have a look

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    England, UK.
    Posts
    526
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi.

    It would sometimes be useful if a big macro I had could have some sort of 'timeout' thing so that the user could check hwo things are going mid-macro and stop it before it makes a complete hash of things.

    How would you suggest doing this.

    It would be handy to get the user to, after inspecting what the macro has done, have a choice of 2 buttons - OK to continue and cancel to abort macro.

    Any suggestions welcomed.

    thanks,

    RET79

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-27 15:52, RET79 wrote:
    Hi.

    It would sometimes be useful if a big macro I had could have some sort of 'timeout' thing so that the user could check hwo things are going mid-macro and stop it before it makes a complete hash of things.

    How would you suggest doing this.

    It would be handy to get the user to, after inspecting what the macro has done, have a choice of 2 buttons - OK to continue and cancel to abort macro.

    Any suggestions welcomed.

    thanks,

    RET79
    Easiest way is to use the Application.Inputbox method
    This Function has OK & cancel
    Just assign these keys to some routine.


    Kind Regards,
    Ivan F Moala From the City of Sails

  3. #3
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Heres an example of what I mean.


    Sub Paused()
    Dim YC As Variant

    On Error Resume Next
    YC = Application.InputBox("Please check the sheets", "Paused for checking")
    If YC = False Then
    '// User cancelled!
    MsgBox "Cancelled"
    Else
    '// User selected OK
    MsgBox YC & " User pressed OK"
    End If
    On Error GoTo 0

    End Sub


    Kind Regards,
    Ivan F Moala From the City of Sails

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    England, UK.
    Posts
    526
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Ivan, that's perfect.

    Thanks so much,

    RET79

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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