ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disabling of Cut and Paste commands on CELL (https://www.excelbanter.com/excel-programming/358233-disabling-cut-paste-commands-cell.html)

Mark

Disabling of Cut and Paste commands on CELL
 
Hi All,
Please advise how to disable cut and paste on cells right click
menu, on the kyboard (Ctrl+X, Ctrl+V) and from the "Edit" menu.

Thanks in advance!

Mark

Ron de Bruin

Disabling of Cut and Paste commands on CELL
 
Hi Mark

See the VBA help for Onkey for the shortcuts

And you can use this

Sub MenuControl_Enabled_False()
' Excel 97 - 2003
Dim Ctl As CommandBarControl
Dim Cbar As Integer

On Error Resume Next
For Cbar = 1 To Application.CommandBars.Count
For Each Ctl In Application.CommandBars(Cbar).Controls
Application.CommandBars(Cbar).FindControl(ID:=21, _
Recursive:=True).Enabled = False
Application.CommandBars(Cbar).FindControl(ID:=22, _
Recursive:=True).Enabled = False
Next Ctl
Next Cbar
On Error GoTo 0
End Sub

Sub MenuControl_Enabled_True()
' Excel 97 - 2003
Dim Ctl As CommandBarControl
Dim Cbar As Integer

On Error Resume Next
For Cbar = 1 To Application.CommandBars.Count
For Each Ctl In Application.CommandBars(Cbar).Controls
Application.CommandBars(Cbar).FindControl(ID:=21, _
Recursive:=True).Enabled = True
Application.CommandBars(Cbar).FindControl(ID:=22, _
Recursive:=True).Enabled = True
Next Ctl
Next Cbar
On Error GoTo 0
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Mark" wrote in message ...
Hi All,
Please advise how to disable cut and paste on cells right click
menu, on the kyboard (Ctrl+X, Ctrl+V) and from the "Edit" menu.

Thanks in advance!

Mark




Mark

Disabling of Cut and Paste commands on CELL
 
thank you Ron!

"Ron de Bruin" wrote:

Hi Mark

See the VBA help for Onkey for the shortcuts

And you can use this

Sub MenuControl_Enabled_False()
' Excel 97 - 2003
Dim Ctl As CommandBarControl
Dim Cbar As Integer

On Error Resume Next
For Cbar = 1 To Application.CommandBars.Count
For Each Ctl In Application.CommandBars(Cbar).Controls
Application.CommandBars(Cbar).FindControl(ID:=21, _
Recursive:=True).Enabled = False
Application.CommandBars(Cbar).FindControl(ID:=22, _
Recursive:=True).Enabled = False
Next Ctl
Next Cbar
On Error GoTo 0
End Sub

Sub MenuControl_Enabled_True()
' Excel 97 - 2003
Dim Ctl As CommandBarControl
Dim Cbar As Integer

On Error Resume Next
For Cbar = 1 To Application.CommandBars.Count
For Each Ctl In Application.CommandBars(Cbar).Controls
Application.CommandBars(Cbar).FindControl(ID:=21, _
Recursive:=True).Enabled = True
Application.CommandBars(Cbar).FindControl(ID:=22, _
Recursive:=True).Enabled = True
Next Ctl
Next Cbar
On Error GoTo 0
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Mark" wrote in message ...
Hi All,
Please advise how to disable cut and paste on cells right click
menu, on the kyboard (Ctrl+X, Ctrl+V) and from the "Edit" menu.

Thanks in advance!

Mark






All times are GMT +1. The time now is 06:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com