+ Reply to Thread
Results 1 to 10 of 10

Disable Escape Key

  1. #1
    Registered User
    Join Date
    01-23-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    18

    Disable Escape Key

    Hi,
    I am trying to stop my users from hitting esc key while importing the text file through selection
    Please Login or Register  to view this content.

    I wish that at this stage the escape key should be disabled & message them that esc key is disabled.

    I have tried using Application.EnableCancelKey = xlDisabled but at the end it reaches to .Refresh BackgroundQuery:=False
    ( I have tried True also) but no luck.

    Please any help.
    Last edited by Leith Ross; 10-15-2011 at 07:46 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Disable Escape Key

    Hello foncesa,

    You can reassign the escape key to another another macro temporarily using Application.OnKey

    Here is an example:
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Disable Escape Key

    You might want to consider that some users, when they find that the ESC key doesn't work, begin unplugging equipment.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Disable Escape Key

    I agree with Mike.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Disable Escape Key

    My tweaking tool of choice is a 3lb. sledge hammer. Always close at hand.

  6. #6
    Registered User
    Join Date
    01-23-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Disable Escape Key

    Hi,
    Thanks for the reply but still unable to achive the results.
    Please Login or Register  to view this content.


    It shows this error message.

    Please Login or Register  to view this content.
    & if debug is pressed it reaches
    Please Login or Register  to view this content.
    Last edited by foncesa; 10-16-2011 at 10:19 AM.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Disable Escape Key

    Please change your QUOTE tags to CODE tags.

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Disable Escape Key

    Did you translate the error message

    Excel cannot find the text file to refresh this external date range.
    Check to make sure the text file has not been moved or renamed, then try the refresh again.
    into a language you understand ?



  9. #9
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Disable Escape Key

    Perhaps try Application.EnableCancelKey = xlDisabled

    It deals with how VBA should handle whenever the user presses the ESC key when a macro is run. By default its xlInterrupt.

  10. #10
    Registered User
    Join Date
    03-10-2014
    Location
    Stonewall, MB, Canada
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Disable Escape Key

    Private Sub Workbook()
    Application.OnKey "{ESC}", ""
    End Sub

+ 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