我需要你的幫助; 我有這兩個代碼: 首先是要禁用複製過去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