ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modify code to disable "paste" (https://www.excelbanter.com/excel-programming/301696-modify-code-disable-paste.html)

Jonsson[_34_]

Modify code to disable "paste"
 
Hi,

I have got this code from the forum, and it works great, but can anyon
help me to modify it a little bit?

I want it to disable "paste" so the only way that is possible should b
to "paste special", "values".

Any help is appreciated!

Thomas

Dim oCtls As CommandBarControls, oCtl As CommandBarControl
Set oCtls = CommandBars.FindControls(ID:=21) ''Cut
If Not oCtls Is Nothing Then
For Each oCtl In oCtls
oCtl.Enabled = False
Next
End If
Set oCtls = CommandBars.FindControls(ID:=522) ''Options
If Not oCtls Is Nothing Then
For Each oCtl In oCtls
oCtl.Enabled = False
Next
End If
With Application
.OnKey "^x", ""
.OnKey "+{Del}", ""
.CellDragAndDrop = False

End Wit

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 04:41 AM.

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