Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default OnKey Method

I got a response from Tom Ogilvy regarding how to assign a shortcut key to VB
code, which was to use the OnKey Method. My problem is I'm a bit dim when it
comes to methods, etc. Does the method go into a procedure of its own which
then calls the onkey procedure? Obviously, I'm really confused. Thanks for
any help I can get.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default OnKey Method

Sub SetAssignment()
Application.OnKey "^r", "MyMacro"
End Sub

Sub ResetAssignment()
Application.OnKey "^r"
End sub

You would have to run SetAssignment, then if you did Ctrl+r you should have
MyMacro run.

If you run ResetAssignment, Ctrl+r is set back to its default action

This is only in effect as long as Excel is open. When you do the
assignment, the workbook containing mymacro should be open.

If you want to have this assignment in effect most of the time, put the
assignment macro and the macro to execute in in your Personal.xls and in the
workbook_open event of personal.xls, call the setassignment macro.

--
Regards,
Tom Ogilvy


"cottage6" wrote in message
...
I got a response from Tom Ogilvy regarding how to assign a shortcut key to

VB
code, which was to use the OnKey Method. My problem is I'm a bit dim when

it
comes to methods, etc. Does the method go into a procedure of its own

which
then calls the onkey procedure? Obviously, I'm really confused. Thanks

for
any help I can get.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
onkey method freekrill Excel Discussion (Misc queries) 1 October 12th 05 01:31 PM
Problem mapping procedure using OnKey Method Adrian[_7_] Excel Programming 1 August 4th 04 12:58 PM
onkey peter Excel Programming 2 March 2nd 04 07:34 PM
Onkey Method Fred Lambelet Excel Programming 3 January 23rd 04 05:20 AM
Onkey Jase Excel Programming 1 November 17th 03 11:07 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"