Question

Locked

Prevent the use of a copy button on the ribbon

By markcicoff ·
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?


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

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Web Development Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums