Redefining the Ctrl [ and Ctrl ]s short cut with OnKey?

J

John Wirt

I would like to assign subroutines to two key sequences, default Excel
shortcut key sequences: Ctrl [ and Ctrl ].

Is this possible?

I placed this code in the "ThisWorkbook" module of PERSONAL.xls and got this
error: "Method 'OnKey' object '_Application' failed.

-------
Option Explicit
Private Sub Workbook_Open()
Application.OnKey "^[", "FindLinkedCell"
Application.OnKey "^[", "ReturnToCell"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnKey "^["
Application.OnKey "^]"
End Sub
 
J

John Wirt

Yes, the error is: Method 'OnKey' of object '_Application' failed.


The code is (copied):

Private Sub Workbook_Open()
Application.OnKey "^([)", "FindLinkedCell"
Application.OnKey "^(])", "ReturnToCell"
End Sub

John
 
R

Ron de Bruin

Use a { and not a (



--
Regards Ron de Bruin
http://www.rondebruin.nl



John Wirt said:
Yes, the error is: Method 'OnKey' of object '_Application' failed.


The code is (copied):

Private Sub Workbook_Open()
Application.OnKey "^([)", "FindLinkedCell"
Application.OnKey "^(])", "ReturnToCell"
End Sub

John
----------------------------
Ron de Bruin said:
Hi John

Do you see an error?
 

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

Top