Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Help with shortcut key code

I have created a bunch of macros and want to assign shortcut keys to
them using code instead of the tools option method since you have to
assign to a letter using that method. I have a bunch of subs that are
very basic and work when I use F5. To assign macros I created the
following code in the same module as the subs.

Public Sub Workbook_Open()
With Application
.OnKey key:="+^{$}", procedu="fmtDollar"
.OnKey key:="+^{%}", procedu="fmtPercent"
.OnKey key:="+^{!}", procedu="fmtComma"
.OnKey key:="+^{~}", procedu="fmtGeneral"
End With
End Sub

I cannot for the life of me figure out why the subs won't fire using
ctrl+shift+4, ctrl+shift+5 etc...

Any help is greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Help with shortcut key code

I assume the use of the ":=" is a typo because the
compiler should have choked on this. To get numbers to
work leave them outside of the curly brackets:-

Sub OnKey()
Application.OnKey "^+4", "TestOnKey"
End Sub

Sub TestOnKey()
MsgBox "OnKey worked !!!"
End Sub

Regards,
Greg
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Help with shortcut key code

That seemed to work. Thanks.

"Greg Wilson" wrote in message ...
I assume the use of the ":=" is a typo because the
compiler should have choked on this. To get numbers to
work leave them outside of the curly brackets:-

Sub OnKey()
Application.OnKey "^+4", "TestOnKey"
End Sub

Sub TestOnKey()
MsgBox "OnKey worked !!!"
End Sub

Regards,
Greg

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
shortcut has change or move so this shortcut can not open bakerstreet Excel Worksheet Functions 2 April 2nd 10 01:21 PM
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
macro code shortcut Brian Excel Worksheet Functions 4 December 15th 04 08:59 PM
Delete Shortcut with Code zSplash Excel Programming 9 April 10th 04 06:55 PM
Disabling the CONTROL + BREAK shortcut key function - HAVING PROBLEM - MY CODE DOES NOT WORK Marcello do Guzman Excel Programming 0 January 15th 04 02:41 AM


All times are GMT +1. The time now is 03:12 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"