Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I've two questions :
- is it possible in excel to lock the keyboard i.e. user cannot press any key or pressing a key does not have any effect. - Secondly, if possible, can we lock the keyboard for a given range only ? also, can we pass a message when user presses any key ? Please don't quote Tools-Protection, I know about that option but something else. |
#2
![]() |
|||
|
|||
![]()
You would have to use Excel programming code - VBA
or possibly a Windows API function. Jim Cone San Francisco, USA wrote in message ups.com... I've two questions : - is it possible in excel to lock the keyboard i.e. user cannot press any key or pressing a key does not have any effect. - Secondly, if possible, can we lock the keyboard for a given range only ? also, can we pass a message when user presses any key ? Please don't quote Tools-Protection, I know about that option but something else. |
#3
![]() |
|||
|
|||
![]()
I'm ok to use either of these. Could you please suggest some example ?
|
#4
![]() |
|||
|
|||
![]()
Take a look at the "Interactive" property of the
Application object. It blocks most use of the keyboard. Also the following code could be experimented with... '--------------------------------------------------------------- Laurent Longre ) 10/12/2000 public.excel.programming Disabling All Key Combinations Dim K Dim Key Dim Key2 Dim I As Integer On Error Resume Next K = Array("{BS}", "{BREAK}", "{CAPSLOCK}", "{CLEAR}", "{DEL}", _ "{DOWN}", "{END}", "{ENTER}", "~", "{ESC}", "{HELP}", "{HOME}", _ "{INSERT}", "{LEFT}", "{NUMLOCK}", "{PGDN}", "{PGUP}", _ "{RETURN}", "{RIGHT}", "{SCROLLLOCK}", "{TAB}", "{UP}") For Each Key In Array("", "+", "^", "%", "+^", "+%", "^%", "+^%") For Each Key2 In K Application.OnKey Key & Key2, "" Next Key2 For I = 1 To 15 Application.OnKey Key & "{F" & I & "}", "" Next I For I = 0 To 255 Application.OnKey Key & Chr$(I), "" Next I Next Key ------------------------------- '(To enable "Normal" keys) jbc ------------------------------- Dim Key, I As Integer On Error Resume Next For Each Key In Array("^", "%", "+^", "+%", "^%", "+^%") For I = 32 To 255 Application.OnKey Key & Chr$(I)', "" Next I Next Key '------------------------------------ I've never done much with this concept as I feel it could turn very ugly on you. User training is an alternative. Jim Cone San Francisco, USA wrote in message oups.com... I'm ok to use either of these. Could you please suggest some example ? |
#5
![]() |
|||
|
|||
![]()
Another approach could be...
In a regular module add code like this... '---------------------- Sub InformUser() Dim FirstAssumption Dim SecondAssumption 'code here determines variable values If FirstAssumption = SecondAssumption Then MsgBox "Please do not make changes to the worksheet. " & vbCr & _ "Contact your supervisor if you have questions. ", _ vbCritical, " Don't do that" Application.Undo End If End Sub '---------------------- In the code module for the sheet add code like this... Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False 'Call sub InformUser Application.EnableEvents = True End Sub '-------------------- Jim Cone San Francisco, USA "Jim Cone" wrote in message ... Take a look at the "Interactive" property of the Application object. It blocks most use of the keyboard. Also the following code could be experimented with... '--------------------------------------------------------------- Laurent Longre ) 10/12/2000 public.excel.programming Disabling All Key Combinations Dim K Dim Key Dim Key2 Dim I As Integer On Error Resume Next K = Array("{BS}", "{BREAK}", "{CAPSLOCK}", "{CLEAR}", "{DEL}", _ "{DOWN}", "{END}", "{ENTER}", "~", "{ESC}", "{HELP}", "{HOME}", _ "{INSERT}", "{LEFT}", "{NUMLOCK}", "{PGDN}", "{PGUP}", _ "{RETURN}", "{RIGHT}", "{SCROLLLOCK}", "{TAB}", "{UP}") For Each Key In Array("", "+", "^", "%", "+^", "+%", "^%", "+^%") For Each Key2 In K Application.OnKey Key & Key2, "" Next Key2 For I = 1 To 15 Application.OnKey Key & "{F" & I & "}", "" Next I For I = 0 To 255 Application.OnKey Key & Chr$(I), "" Next I Next Key ------------------------------- '(To enable "Normal" keys) jbc ------------------------------- Dim Key, I As Integer On Error Resume Next For Each Key In Array("^", "%", "+^", "+%", "^%", "+^%") For I = 32 To 255 Application.OnKey Key & Chr$(I)', "" Next I Next Key '------------------------------------ I've never done much with this concept as I feel it could turn very ugly on you. User training is an alternative. Jim Cone San Francisco, USA wrote in message oups.com... I'm ok to use either of these. Could you please suggest some example ? |
#6
![]() |
|||
|
|||
![]()
Jim,
you're the man !! that's exactly what I was looking for - both examples. I'd give them a try shortly and let you know how it worked. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to lock worksheet formatting? | Excel Worksheet Functions | |||
How to lock worksheet formatting? | Excel Worksheet Functions | |||
keyboard shortcut | Excel Worksheet Functions | |||
Why is pointer and keyboard control is lost in certain Excel file. | Excel Discussion (Misc queries) | |||
scroll lock | Excel Discussion (Misc queries) |