ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.Onkey (https://www.excelbanter.com/excel-programming/437550-application-onkey.html)

John

Application.Onkey
 
Hi,

Is there a way i can shorten:

With Application

.OnKey "{DOWN}"
.OnKey "{BS}"
.OnKey "{END}"
.OnKey "{HOME}"
.OnKey "{UP}"
.OnKey "{TAB}"
.OnKey "{PGDN}"
.OnKey "{PGUP}"
.OnKey "{RIGHT}"
.OnKey "{LEFT}"
.OnKey "{DELETE}"
.OnKey "{ESC}"
.OnKey "^{DEL}"
.OnKey "^{INSERT}"
.OnKey "^{F1}"
.OnKey "^{F2}"
.OnKey "^{F3}"
.OnKey "^{F4}"
.OnKey "^{F5}"
.OnKey "^{F6}"
.OnKey "^{F7}"
.OnKey "^{F8}"
.OnKey "^{F9}"
.OnKey "^{F10}"
.OnKey "^{F11}"
.OnKey "^{F12}"

End With

I've tried to use a reference to each of the keystrokes {DOWN} {BS} etc in a
sheet array Tbl_Keys and reference this in VB using:

Mykey = " ""{" & Application.WorksheetFunction.Index(Rng, I, 1) & "}, """
Application.OnKey Mykey

but i when i try to run it i get the message "Method 'Onkey of
Object_Application' failed.

Any ideas would be great.
Thanks
John



Peter T

Application.Onkey
 
What are you trying to do and why

Regards,
Peter T

"John" wrote in message
...
Hi,

Is there a way i can shorten:

With Application

.OnKey "{DOWN}"
.OnKey "{BS}"
.OnKey "{END}"
.OnKey "{HOME}"
.OnKey "{UP}"
.OnKey "{TAB}"
.OnKey "{PGDN}"
.OnKey "{PGUP}"
.OnKey "{RIGHT}"
.OnKey "{LEFT}"
.OnKey "{DELETE}"
.OnKey "{ESC}"
.OnKey "^{DEL}"
.OnKey "^{INSERT}"
.OnKey "^{F1}"
.OnKey "^{F2}"
.OnKey "^{F3}"
.OnKey "^{F4}"
.OnKey "^{F5}"
.OnKey "^{F6}"
.OnKey "^{F7}"
.OnKey "^{F8}"
.OnKey "^{F9}"
.OnKey "^{F10}"
.OnKey "^{F11}"
.OnKey "^{F12}"

End With

I've tried to use a reference to each of the keystrokes {DOWN} {BS} etc in
a
sheet array Tbl_Keys and reference this in VB using:

Mykey = " ""{" & Application.WorksheetFunction.Index(Rng, I, 1) & "}, """
Application.OnKey Mykey

but i when i try to run it i get the message "Method 'Onkey of
Object_Application' failed.

Any ideas would be great.
Thanks
John





Ron de Bruin

Application.Onkey
 
Maybe
http://www.rondebruin.nl/key.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"John" wrote in message ...
Hi,

Is there a way i can shorten:

With Application

.OnKey "{DOWN}"
.OnKey "{BS}"
.OnKey "{END}"
.OnKey "{HOME}"
.OnKey "{UP}"
.OnKey "{TAB}"
.OnKey "{PGDN}"
.OnKey "{PGUP}"
.OnKey "{RIGHT}"
.OnKey "{LEFT}"
.OnKey "{DELETE}"
.OnKey "{ESC}"
.OnKey "^{DEL}"
.OnKey "^{INSERT}"
.OnKey "^{F1}"
.OnKey "^{F2}"
.OnKey "^{F3}"
.OnKey "^{F4}"
.OnKey "^{F5}"
.OnKey "^{F6}"
.OnKey "^{F7}"
.OnKey "^{F8}"
.OnKey "^{F9}"
.OnKey "^{F10}"
.OnKey "^{F11}"
.OnKey "^{F12}"

End With

I've tried to use a reference to each of the keystrokes {DOWN} {BS} etc in a
sheet array Tbl_Keys and reference this in VB using:

Mykey = " ""{" & Application.WorksheetFunction.Index(Rng, I, 1) & "}, """
Application.OnKey Mykey

but i when i try to run it i get the message "Method 'Onkey of
Object_Application' failed.

Any ideas would be great.
Thanks
John




All times are GMT +1. The time now is 09:59 AM.

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