|
老师好,下面的代码是禁止复制粘贴,在运行该程序后,就不能复制粘贴了,如果我想解除复制粘贴的限制,代码如何修改呢?谢谢
Sub 禁止复制粘贴()
With Application
'屏蔽常用工具栏剪切、复制、粘贴
.CommandBars(3).Controls("剪切(&T)").Enabled = False
.CommandBars(3).Controls("复制(&C)").Enabled = False
.CommandBars(3).Controls("粘贴(&P)").Enabled = False
'屏蔽单元格右键菜单中的剪切、复制、粘贴命令
.CommandBars("Cell").Controls("剪切(&T)").Enabled = False
.CommandBars("Cell").Controls("复制(&C)").Enabled = False
.CommandBars("Cell").Controls("粘贴(&P)").Enabled = False
'屏蔽编辑菜单中的剪切、复制、粘贴命令
.CommandBars(1).Controls("编辑(&E)").Controls("剪切(&T)").Enabled = False
.CommandBars(1).Controls("编辑(&E)").Controls("复制(&C)").Enabled = False
.CommandBars(1).Controls("编辑(&E)").Controls("粘贴(&P)").Enabled = False
'屏蔽键盘剪切、复制、粘贴键
.OnKey "^x", ""
.OnKey "^c", ""
.OnKey "^v", ""
.OnKey "^{Insert}", ""
.OnKey "+{Insert}", ""
End With
End Sub
|
|