PC Review


Reply
Thread Tools Rate Thread

Application.onKey non-functioning

 
 
=?Utf-8?B?TWFkaGFu?=
Guest
Posts: n/a
 
      12th Dec 2006
Hi,
I tried adding more than one Application.onKey entries to capture up-arrow,
down-arrow, right-arrow and left-arrow keys, but, none of the procedures
associated with each of the Application.onKey entries are activated.
I tried using breakpoints and msgbox statement.
Is there a restriction on the number of Application.onKey entries ? Or is
there some other issue ?
Help would definitely be appreciated.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFkaGFu?=
Guest
Posts: n/a
 
      12th Dec 2006
Hi, I have written a Sub that is triggered when I press CTRL+E (this act was
recorded using macro recorder). That sub contains the following statements.
Application.OnKey "{ESC}", "moveNone"
Application.OnKey "{UP}", "moveUp"
Application.OnKey "{DOWN}", "moveDown"
Application.OnKey "{LEFT}", "moveLeft"
Application.OnKey "{RIGHT}", "moveRight"
start

"Martin Fishlock" wrote:

> Madhan,
>
> Where are you running the application.onkey code?
>
> Also pls post the code for the onkey entries.
>
> --
> Hope this helps
> Martin Fishlock
> Please do not forget to rate this reply.
>
>
> "Madhan" wrote:
>
> > Hi,
> > I tried adding more than one Application.onKey entries to capture up-arrow,
> > down-arrow, right-arrow and left-arrow keys, but, none of the procedures
> > associated with each of the Application.onKey entries are activated.
> > I tried using breakpoints and msgbox statement.
> > Is there a restriction on the number of Application.onKey entries ? Or is
> > there some other issue ?
> > Help would definitely be appreciated.

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      13th Dec 2006
Sounds like you need to use a timer to move the selection, dependent on the
value set by the arrow keys. Or stop if ESC was pressed.

NickHK

"Madhan" <(E-Mail Removed)> wrote in message
news:01223803-CE56-4C66-9CBD-(E-Mail Removed)...
> Hi, yes it works. Now, the requirement seems to have changed. The
> registration of the key event handlers is expected to work in parallel.
> In an infinite loop which iterates through various cells of a worksheet,
> whenever the appropriate key is pressed, the direction of the cell

navigation
> should change. For example, when I press Down-arrow key, the cell

navigation
> should change its current direction and should navigate downwards.
> This never happens, since the infinite loop is a tight loop and hence the
> key events are not recognised, though you may press the key for many

number
> of times.
>
> "Martin Fishlock" wrote:
>
> > Madhan
> >
> > I tried the code below and it worked.
> >
> > You need to call activateonkey and then you can press the keys and the
> > message boxes appear. After you are finished call deactivateonkey to

cancel
> > them.
> >
> >
> >
> > Sub activateonkey()
> > Application.OnKey "{ESC}", "moveNone"
> > Application.OnKey "{UP}", "moveUp"
> > Application.OnKey "{DOWN}", "moveDown"
> > Application.OnKey "{LEFT}", "moveLeft"
> > Application.OnKey "{RIGHT}", "moveRight"
> >
> > End Sub
> >
> > Sub deactivateonkey()
> > Application.OnKey "{ESC}"
> > Application.OnKey "{UP}"
> > Application.OnKey "{DOWN}"
> > Application.OnKey "{LEFT}"
> > Application.OnKey "{RIGHT}"
> >
> > End Sub
> > Sub moveUp()
> > MsgBox "moveup"
> > End Sub
> > Sub moveDown()
> > MsgBox "movedown"
> > End Sub
> > Sub moveLeft()
> > MsgBox "moveleft"
> > End Sub
> > Sub moveRight()
> > MsgBox "moveRight"
> > End Sub
> > Sub moveNone()
> > MsgBox "moveEscNone"
> > End Sub
> >
> >
> > --
> > Hope this helps
> > Martin Fishlock
> > Please do not forget to rate this reply.
> >
> >
> > "Madhan" wrote:
> >
> > > Hi, I have written a Sub that is triggered when I press CTRL+E (this

act was
> > > recorded using macro recorder). That sub contains the following

statements.
> > > Application.OnKey "{ESC}", "moveNone"
> > > Application.OnKey "{UP}", "moveUp"
> > > Application.OnKey "{DOWN}", "moveDown"
> > > Application.OnKey "{LEFT}", "moveLeft"
> > > Application.OnKey "{RIGHT}", "moveRight"
> > > start
> > >
> > > "Martin Fishlock" wrote:
> > >
> > > > Madhan,
> > > >
> > > > Where are you running the application.onkey code?
> > > >
> > > > Also pls post the code for the onkey entries.
> > > >
> > > > --
> > > > Hope this helps
> > > > Martin Fishlock
> > > > Please do not forget to rate this reply.
> > > >
> > > >
> > > > "Madhan" wrote:
> > > >
> > > > > Hi,
> > > > > I tried adding more than one Application.onKey entries to capture

up-arrow,
> > > > > down-arrow, right-arrow and left-arrow keys, but, none of the

procedures
> > > > > associated with each of the Application.onKey entries are

activated.
> > > > > I tried using breakpoints and msgbox statement.
> > > > > Is there a restriction on the number of Application.onKey entries

? Or is
> > > > > there some other issue ?
> > > > > Help would definitely be appreciated.



 
Reply With Quote
 
tom lorenz
Guest
Posts: n/a
 
      21st Dec 2006
hi
same issue
i got round it very inelegantly with:
setting up a command button
setting the accelerator to the key i wanted to use

the computer can still pick up these keypresses ie alt+k, when it seems to be blind to application.onkey "k","proc"

very irritating. i then set sticky keys on and pressed alt x2, to remove the need to keep pressing alt key with my short cut keys.

i tried putting :Application.SendKeys ("^{break}")
within the infinite loop, but this didnt work for me

any thoughts?
tom

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
Reply With Quote
 
tom lorenz
Guest
Posts: n/a
 
      21st Dec 2006
hi
same issue
i got round it very inelegantly with:
setting up a command button
setting the accelerator to the key i wanted to use

the computer can still pick up these keypresses ie alt+k, when it seems to be blind to application.onkey "k","proc"

very irritating. i then set sticky keys on and pressed alt x2, to remove the need to keep pressing alt key with my short cut keys.

i tried putting :Application.SendKeys ("^{break}")
within the infinite loop, but this didnt work for me

any thoughts?
tom

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.Onkey John Microsoft Excel Programming 2 17th Dec 2009 08:17 PM
Application.OnKey iamnu Microsoft Excel Discussion 1 26th Mar 2009 01:58 PM
How to apply Application.OnKey dewanna Microsoft Excel Programming 1 7th Apr 2006 07:16 AM
Application.OnKey Kevin H. Stecyk Microsoft Excel Programming 1 27th Jan 2005 01:26 AM
Application.OnKey problem R Avery Microsoft Excel Programming 0 8th Jul 2004 06:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:05 PM.