ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Onkey doesn't work (https://www.excelbanter.com/excel-programming/358794-onkey-doesnt-work.html)

Stefi

Onkey doesn't work
 
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


Jan Karel Pieterse

Onkey doesn't work
 
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


Stefi

Onkey doesn't work
 
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:

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



Jan Karel Pieterse

Onkey doesn't work
 
Hi Stefi,

I didn't know that
Onkey doesn't affect the numeric keys. Or does it? If so, how?


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


Stefi

Onkey doesn't work
 
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,

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



Jan Karel Pieterse

Onkey doesn't work
 
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


lonfnico[_6_]

Onkey doesn't work
 

Jan Karel Pieterse Wrote:
Hi Stefi,

I didn't know that
Onkey doesn't affect the numeric keys. Or does it? If so, how?


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

--
lonfnic
-----------------------------------------------------------------------
lonfnico's Profile: http://www.excelforum.com/member.php...fo&userid=3339
View this thread: http://www.excelforum.com/showthread.php?threadid=53257


Stefi

Onkey doesn't work
 
Hi Jan,

Please let me know if you find an answer!

Regards,
Stefi


€˛Jan Karel Pieterse€¯ ezt Ć*rta:

Hi Stefi,

I didn't know that
Onkey doesn't affect the numeric keys. Or does it? If so, how?


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




All times are GMT +1. The time now is 01:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com