application.onkey doesn't work within a cell

  • Thread starter Thread starter ndell1
  • Start date Start date
N

ndell1

Hi,

I've set Application.OnKey "{F12}", "" in my workbook's open method.

It disables the F12 key fine, until I double-click a cell to edit
directly in a cell. F12 becomes functional at that point.

Any suggestions on disabling a key whilst directly editing a cell?

Thanks.
 
I never knew that about OnKey.

Brute force usually works.<g>
In the sheet module, add this code and no editing in any
cell is possible (i think)...

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
MsgBox "Please use the formula bar to edit this cell. ", , "Aggravating Isn't It"
End Sub

-or-
In Tools | Options | Edit (tab)...
uncheck "Edit directly in cell"

-or-
use this code with OnKey code when you open the workbook...
Application.EditDirectlyInCell = False
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



<[email protected]>
wrote in message
Hi,
I've set Application.OnKey "{F12}", "" in my workbook's open method.
It disables the F12 key fine, until I double-click a cell to edit
directly in a cell. F12 becomes functional at that point.
Any suggestions on disabling a key whilst directly editing a cell?
Thanks.
 
Back
Top