How can I disable the space bar button and delete button ?
is there an easy way to identify keyboard keys in vba ? to they have numbers assigned to them or soemthing ?
How can I disable the space bar button and delete button ?
is there an easy way to identify keyboard keys in vba ? to they have numbers assigned to them or soemthing ?
Where can I get a Menu Item list ?
You can intercept keys in Excel VBA by using the OnKey method in the Excel application object. Basically you tell Excel to execute a VBA sub when the user hits a button instead of whatever Excel usually does. To set it up you would have to put in the OnKey calls on the workbook_open event in the ThisWorkbook module. It would be something like this:
[VBA]
Private Sub Workbook_Open()
Application.OnKey "{DELETE}", "InterceptKey"
Application.OnKey " ", "InterceptKey"
Application.OnKey "{BACKSPACE}", "InterceptKey"
End Sub[/VBA]
where you have a public InterceptKey sub in a standard module. This will get called when you hit delete, backspace, or the spacebar. In the workbook_close event you'd have to undo this, passing a blank string rather than "InterceptKey"
Hope that helps...
Jon
Do you know the menuitem number for clearcontents ?
Call EnableMenuItem(755, Allow) ' pastespecial
Cheers mate thanks