How do I turn off F1 Help key

E

ernestgoh

When you press F1 the help window will pop up.

The trouble is I use alot of F2 and sometime I accidentally press F1.

How do I turn off or customise F1?

Thanks for your help!
 
E

Earl Kiosterud

Ernest,

In module ThisWorkbook, paste this (from here):

Private Sub Workbook_Open()
Application.OnKey "{F1}", "Stub"
End Sub

And in a regular module:

Sub Stub()
MsgBox "Hey, dodo, quit pressing the F1 key."
End Sub

The middle line is optional. This will remain in effect for all open
workbooks, until Excel is closed.
 
D

Dave Peterson

And you don't even need that stub procedure:

Option Explicit
Sub disableF1()
Application.OnKey "{f1}", ""
End Sub

And for the OP, this would toggle it back to normal.

Sub enableF1()
Application.OnKey "{f1}"
End Sub
 
E

ernestgoh

Hi Dave and Earl,

It works! You guys are geniuses! *Bow x3*

Many thanks, Ernest aka Dodo
 
E

Earl Kiosterud

Ernest,

No we're not. You got questions. I got answers. Dave makes 'em right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top