Prevent the use of a copy button on the ribbon - TechRepublic
Question
July 13, 2009 at 12:24 PM
markcicoff

Prevent the use of a copy button on the ribbon

by markcicoff . Updated 16 years, 11 months ago

I found the code below from the website which works great when using only keystrokes. I am looking to enhance the code below to prevent the use of a copy button on the ribbon. Is this possible?

[code]
Private Sub Workbook_Open()
On Error Resume Next
Application.CommandBars(“Edit”).Controls(“?”).Enabled = False
Application.CommandBars(“cell”).Controls(“?”).Enabled = False
Application.OnKey “^c”, “disablec”
End Sub

Sub disablec()
MsgBox “Copy command disabled”
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars(“Edit”).Controls(“?”).Enabled = True
Application.CommandBars(“cell”).Controls(“?”).Enabled = True
Application.OnKey “^c”, “enablec”
End Sub

‘then put this in a module

Sub enablec()
MsgBox “Copy command disabled”
End Sub
[/code]

This discussion is locked

All Comments