[說明]
將索引標籤強制隱藏,避免人員點選複製、剪下、貼上、列印的功能鈕。


將滑鼠右鍵的複製。剪下、貼上的功能關閉


將快速鍵「Ctrl+C」、「Ctrl+V」、「Ctrl+X」、「Ctrl+P」功能關閉
[程式碼]
Sub Copyprohibited() '關閉複製、剪下、貼上、列印的功能
Dim copyctls As CommandBarControls
Dim copyctl As CommandBarControl
Application.CutCopyMode = False
Application.CommandBars("Office Clipboard").Visible = False '清空剪貼板資訊
Set copyctls = Application.CommandBars.FindControls(ID:=19)
For Each copyctl In copyctls
copyctl.Enabled = False
Next
Set copyctls = Application.CommandBars.FindControls(ID:=21)
For Each copyctl In copyctls
copyctl.Enabled = False
Next
Set copyctls = Application.CommandBars.FindControls(ID:=22)
For Each copyctl In copyctls
copyctl.Enabled = False
Next
Set copyctls = Application.CommandBars.FindControls(ID:=23)
For Each copyctl In copyctls
copyctl.Enabled = False
Next
Set copyctls = Application.CommandBars.FindControls(ID:=755)
For Each copyctl In copyctls
copyctl.Enabled = False
Next
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "^x", ""
Application.OnKey "^p", ""
Application.CommandBars("ply").Controls(5).Enabled = False
Application.ExecuteExcel4Macro "show.toolbar(""ribbon"",False)"
End Sub
------------------------------------------------------------------------
Sub uncopy() '開啟複製。剪下、貼上、列印的功能
Dim copyctls As CommandBarControls
Dim copyctl As CommandBarControl
Application.CutCopyMode = True
Set copyctls = Application.CommandBars.FindControls(ID:=19)
For Each copyctl In copyctls
copyctl.Enabled = True
Next
Set copyctls = Application.CommandBars.FindControls(ID:=21)
For Each copyctl In copyctls
copyctl.Enabled = True
Next
Set copyctls = Application.CommandBars.FindControls(ID:=22)
For Each copyctl In copyctls
copyctl.Enabled = True
Next
Set copyctls = Application.CommandBars.FindControls(ID:=23)
For Each copyctl In copyctls
copyctl.Enabled = True
Next
Set copyctls = Application.CommandBars.FindControls(ID:=755)
For Each copyctl In copyctls
copyctl.Enabled = True
Next
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "^x"
Application.OnKey "^p"
Application.CommandBars("ply").Controls(5).Enabled = True
Application.ExecuteExcel4Macro "show.toolbar(""ribbon"",True)"
End Sub
[特別說明]
插入兩個圖案,分別指定「關閉複製、剪下、貼上、列印的功能」與「開啟複製。剪下、貼上、列印的功能」的巨集,即可執行
謝謝您閱讀了我的文章,若您喜歡我的文章,希望你幫我按個讚,也幫忙分享給需要的朋友或其他平台,謝謝。

文章標籤
全站熱搜