我需要你的帮助; 我有这两个代码: 首先是要禁用复制过去VBA禁用复制粘贴
Sub Desable_Copy()
Dim oCtrl As Office.CommandBarControl
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = False
Next oCtrl
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = False
Next oCtrl
Application.CellDragAndDrop = False
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
With Application
.CellDragAndDrop = False
.CutCopyMode = False 'Clear clipboard
End With
End Sub
二是启用复制过去的宏宏:
Sub Enable_Copy()
Dim oCtrl As Office.CommandBarControl
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = True
Next oCtrl
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = True
Next oCtrl
Application.CellDragAndDrop = True
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
With Application
.CellDragAndDrop = True
.CutCopyMode = True 'Clear clipboard
End With
End Sub
当我EXCUTE的代码,我有错误消息:“检测到模糊名称”
任何想法请!
您有两个'Workbook_SheetSelectionChange'子例程。因此子程序名称是不明确的。 – YowE3K