Onkey doesn't work

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I'm trying to use Onkey method for the first time, but it fails, even if I
try the example in XL2003 Help:
Application.OnKey "^{+}", "InsertProc"

Nothing happens when I press CTRL+{+} button.
I checked EnableEvents, it was set true.

What can be the problem?

Thanks,
Stefi
 
Hi Stefi,
Nothing happens when I press CTRL+{+} button.
I checked EnableEvents, it was set true.

What can be the problem?

ON my keyboard, the plus appears above the equal sign, so I need to
hold the shift key too to make it happen.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
 
Hi Jan,

Yes, if I press the CTRL+SHIFT+Plus sign(in the upper row of the keyboard)
it works. I tried CTRL+Plus sign(on the numeric keypad), I didn't know that
Onkey doesn't affect the numeric keys. Or does it? If so, how?

Regards,
Stefi


„Jan Karel Pieterse†ezt írta:
 
By the way Jan, is it possible to pass a parameter to a sub triggered by
Onkey, something like this:

Application.OnKey "^{+}", "InsertProc(parameter)"

Stefi


„Jan Karel Pieterse†ezt írta:
 
Hi Stefi,
By the way Jan, is it possible to pass a parameter to a sub triggered by
Onkey, something like this:

Application.OnKey "^{+}", "InsertProc(parameter)"

Not that I know of. But you can declare a variable at the top of the module
and use that inside the called routine. That variable will retain its value
for the duration of the project and can be altered (and read) by other subs
in the same module.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
 
Jan said:
Hi Stefi,


Me neither and unfortunately, I cannot test this right now either
(laptop without num pad).

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com

Absolutely no idea if it works, and no time to check before thi
evening, but isnt there something like vbKeyNumpadPlus?
I think it works for numbers, if it does, shouldnt be too hard t
figure out for plus key.

Try something like

-Application.OnKey "{" & vbKeyNumpad1 & "}", "MyMacro"-

As I said, I'm wandering the net lately about excel vb code, and I kno
I've seen that - but no idea if it works
 
Hi Jan,

Please let me know if you find an answer!

Regards,
Stefi


„Jan Karel Pieterse†ezt írta:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top