Hello everyone
How to trigger an event in worksheet change if F12 is pressed ?
I mean when the user press F12 I need to display a message for him or run specific code
Thanks advanced for help
Hello everyone
How to trigger an event in worksheet change if F12 is pressed ?
I mean when the user press F12 I need to display a message for him or run specific code
Thanks advanced for help
Greetings,
In ThisWorkbook Module:
In a Standard Module named Module1:Option Explicit Private Sub Workbook_Activate() Application.OnKey "{F12}", "Module1.example" End Sub Private Sub Workbook_Deactivate() Application.OnKey "{F12}" End Sub
Option Explicit Sub example() MsgBox "I pressed F12!", vbOKOnly Or vbInformation, vbNullString End Sub
Does that help?
Mark
Why not using a button ?
You'd better not interfere with the standard keyboard layout.
@Mr. GTO
Thank you very much for this wonderful solution. That's exactly what I was searching for
@Mr. snb
Thanks for reply. My purpose is to prevent F12 key (Save As Function) and at the same time tell the user it is prohibited ..
Best Regards