Results 1 to 5 of 5

Create custom command to stop code at any point

Threaded View

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    New England
    MS-Off Ver
    Excel 2010
    Posts
    24

    Create custom command to stop code at any point

    Hi All, I am trying to get a piece of macro that will allow me to create a command which ends the macro while running. I know that the standard command is ctrl+break, but I don't want my users to end the macros prematurely so I disabled that command like this:


    On Error Goto MyErrorHandler: 
    Application.EnableCancelKey = xlErrorHandler 
    MyErrorHandler: 
    If Err.Number = 18 Then 
        MsgBox "Stop hitting ctrl + break !!!" 
        Resume 
    End If
    Now I would like to have the option to stop the code while I am running it by creating something else which causes the script to stop. My idea would be something like this but I'm not quite sure how to write it properly:


    On Key Press "ctrl+delete" 
    Exit Sub
    Last edited by sczerniak; 07-15-2013 at 03:12 PM. Reason: I solved my own problem

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Create a command button with code with a command button
    By jakara in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 01:28 PM
  2. Macro to create Command Button and assign code
    By dagindi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2011, 09:19 AM
  3. Replies: 2
    Last Post: 06-27-2011, 10:47 PM
  4. How to create a command button and assign code to it using VBA?
    By surotkin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2007, 10:05 PM
  5. Using code from custom menu bar to a Command button
    By Alex Martinez in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2005, 08:05 AM

Tags for this Thread

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