Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
On Key press
I would like anytime I'm in Exel to be able to hit CRTL ALT ~ and call the
function testmsg. Here is what I have: Application.OnKey "^%{~}", "testmsg" Does this look right? I just put this in a new module but it is not picking up the key press. Am I doing something wrong? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
On Key press
Hello
Why not directly assign a shortcut to your macro (I presume you are talking about a macro and NOT a function in which case it could not work) ? But anyway, to fire your macro with this special key combination, the code (Application.OnKey "^%{~}", "testmsg") should be placed in a "Auto_Open" macro or in the Workbook_Open event of a personnal.xls workbook. The personnal.xls workbook contains macros that are available whenever Excel is open. To do this simply, use the macro recorder and select to record it into the "Personnal Macros Workbook" from the list choice in the macro recording dialog box (please note the option text may vary since I am using a French version). Then amend the macro you've recorded: name it Auto_Open instead of default Macro1 and paste your code. Close Excel and Answer Yes to save changes in the Personnal.xls. Reopen Excel and test your code. HTH Cordially Pascal "pokdbz" a écrit dans le message de news: ... I would like anytime I'm in Exel to be able to hit CRTL ALT ~ and call the function testmsg. Here is what I have: Application.OnKey "^%{~}", "testmsg" Does this look right? I just put this in a new module but it is not picking up the key press. Am I doing something wrong? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
On Key press
If I execute a macro with that command, then it works for me, but remember to
type a tilde you have to use the shift key, so it the combination actually comes out to be Ctrl+Alt+Shift+~ (it may be different on your keyboard, but that is the way it is for mine. The tilde is the uppercase character on the left side of the number row (1st key). Sub ABC() Application.OnKey "^%`", "testmsg" End Sub maybe what you actually want. -- Regards, Tom Ogilvy "pokdbz" wrote: I would like anytime I'm in Exel to be able to hit CRTL ALT ~ and call the function testmsg. Here is what I have: Application.OnKey "^%{~}", "testmsg" Does this look right? I just put this in a new module but it is not picking up the key press. Am I doing something wrong? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Key Press Event | Excel Programming | |||
When I Press the Enter Key Nothing happens. | Excel Discussion (Misc queries) | |||
key press event? | Excel Programming | |||
on press | Excel Programming | |||
on press detection | Excel Programming |