+ Reply to Thread
Results 1 to 5 of 5

Application.OnKey runs into an infinite loop though already disabled

  1. #1
    Registered User
    Join Date
    08-14-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Application.OnKey runs into an infinite loop though already disabled

    Hi.

    I have previously (Excel 2007) used the following piece of VBA code successfully. The procedure is called when ENTER is pressed (by changing the Application.OnKey property) and will under certain cirumstances activate a textbox and otherwise call a "normal" ENTER-keypress.

    However, changing from Excel 2007 to Excel 2013 makes the code run into an infinte loop. It seems like disabling the OnKey event temporarily is no longer a possibility. But does anyone know why? And is there a way to fix the problem?

    Please Login or Register  to view this content.
    Best regards.

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

    Re: Application.OnKey runs into an infinite loop though already disabled

    What is WorkbookCheck?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    08-14-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Application.OnKey runs into an infinite loop though already disabled

    WorbookCheck is a validation function. Is not relevant for the question.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,972

    Re: Application.OnKey runs into an infinite loop though already disabled

    Why don't you use the sheet's activate event to assign the Onkey so you don't need Send keys at all?
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Registered User
    Join Date
    08-14-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Application.OnKey runs into an infinite loop though already disabled

    Quote Originally Posted by romperstomper View Post
    Why don't you use the sheet's activate event to assign the Onkey so you don't need Send keys at all?
    I have various other events of the same type, where it isn't the sheet in which you hit the key, but other criterias that decides whether the procedure should execute or not.
    Last edited by Figdor; 11-05-2014 at 10:40 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Application.OnKey key codes
    By ffffloyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2011, 09:28 AM
  2. Application.Onkey Assistance
    By BigBas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-15-2008, 06:59 PM
  3. How to apply Application.OnKey
    By dewanna in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-07-2006, 02:20 AM
  4. Key trapping without using Application.ONKEY
    By k483 in forum Excel General
    Replies: 0
    Last Post: 05-03-2005, 08:01 AM
  5. Application.OnKey
    By Kevin H. Stecyk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2005, 10:07 PM

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