PDA

View Full Version : [SLEEPER:] Application.onkey



ckolbas
04-21-2011, 08:25 PM
Hello Everyone!

I am trying to assign a keyboard shortcut to a macro.

I am trying to use application.onkey "%r", "analyzerResume"

This bit of code is in the workbook_open

The sub is in module 1.

Is there something that I am missing?

Thanks in advance for any help!
Christian

GTO
04-22-2011, 02:47 AM
I tried:

Private Sub Workbook_Open()
Application.OnKey "%r", "analyzerResume"
End Sub
...works just fine.

I would check to see where you have 'analyzerResume' housed. Is it in a Standard Module where it can be "seen"?

Just a suggestion, but generally, I would use Workbook_Activate and Workbook_Deactivate for addition/deletion of commandbars/shortcut keys... stuff you don't want the user accidently using in another open wb.

Hope that helps,

Mark

elonnmusk
11-18-2024, 11:44 PM
I tried:

Private Sub Workbook_Open()
Application.OnKey "%r", "analyzerResume"
End Sub
...works just fine.


I would check to see where you have 'analyzerResume' housed. Is it in a Standard Module where it can be "seen"?
Just a suggestion, but generally, I would use Workbook_Activate and Workbook_Deactivate for addition/deletion of commandbars/shortcut keys... stuff you don't want the user accidently using in another open wb.

Hope that helps,

Mark
I will try this way.

Paul_Hossler
11-19-2024, 05:43 AM
@elonmusk -- you're adding to a 13+ year old thread. Might not be worthwhile

Suggest you always check the age of the thread before you add to it since after 13 years it's probably OBE

Aussiebear
11-19-2024, 04:58 PM
@ Paul, The post by elonnmusk was made in an effort to introduce spam to the forum.

Paul_Hossler
11-20-2024, 05:47 AM
:thumb