Disable F1 key

irchris

New Member
Joined
Nov 29, 2005
Messages
7
Does anyone know if it's possible to disable access to help via the f1 key, but still retain access to it on the drop down menus?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Yes, using VBA you can. But why? That will annoy most users. Are you going to disable it on the main menu as well?
 
Upvote 0
Hi irchris,

Try this code................

Sub Workbook_Activate()
Application.OnKey "{F1}"
End Sub

HTH

Russ
 
Upvote 0
Russ, close, but it would need to look like this:

<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Activate()
    Application.OnKey "{F1}", vbNullString
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>

<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Deactivate()
    Application.OnKey "{F1}"
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>

This assumes that irchris (a) knows how to get to the VBE and (b) how to get to the workbook's code page. Note that this is only his third post here.
 
Upvote 0
Thanks for the replies.

I guess I should clarify a bit. Sometimes when I go to hit the Esc key, but hit the f1 key instead. That results in the wait for help to come up. I find it very irritating when I'm trying to get work done.

I'm not so much looking to disable it in a specific workbook, but for any Excel file I bring up on my PC.

Oh yeah, I'm using Excel 2000.
 
Upvote 0
In that case you'd want to add the following to your personal macro workbook. (See below if you are unfamiliar with this process.)

<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Open()
    Application.OnKey "{F1}", vbNullString
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT><hr />

To add code to a workbook:
  1. Alt+F11 to get to the Visual Basic Editor (VBE).
  2. From the VBE menu Insert|Module
  3. Add in code (copy and paste).
  4. Alt+F11 again to jump back to Excel.
  5. Alt+F8 then pick the macro from the list.
Note: It's usually a good idea to save your work before running new macros.<hr>If you wish to always have the macro available and not just when one particular workbook is open - i.e. the macro is a "generic" macro; it is better to place the macro in your Personal Macro Workbook. This is a workbook that Excel automatically creates. If you use the Macro Recorder to record a macro, the dialog box asks where you want to store the macro: (a) the active wb, (b) a new wb or (c) in your Personal Macro wb. If you select Personal Macro Workbook and you have not previously recorded a macro there, Excel will create it for you, naming it Personal.xls and placing it in your Excel startup directory. This way every time you start Excel, Personal.xls will load and its macros will be available to you. (Note that Personal.xls is a hidden workbook and not an Excel Add-In.)
 
Upvote 0
Meant to add this...

This code needs to go into the Workbook Code Module and not a Standard Module. In the VBE you should see a list of VB projects, including your personal macro workbook. If you do not, then hit Ctrl+R to activate the Project Explorer window. If it is collapsed, expand the item for your personal macro workbook. You should see a small XL icon and ThisWorkbook. Double click that to open the workbook code module. If you are in the correct spot, then the VBE's title bar should have "ThisWorkbook (Code)" in brackets at the end of the application title.

HTH
 
Upvote 0
Hey guys,

I tried this but i have to run the macro always when i open the excel.
is this possible to make it steady. I just dont want f1 in my excel life :)
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,497
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top