View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ronald Dodge[_2_] Ronald Dodge[_2_] is offline
external usenet poster
 
Posts: 130
Default Disable Copy/Paste

This doesn't account for doing the copy/cut and pasting by keyboard method.
There are 2 different keyboard combinations for each of the copying (Ctrl-C
and Ctrl-Insert), cutting (Ctrl-X and Shift-Del) and pasting (Ctrl-V and
Shift-Insert). Note, the first set of the 2 keyboard combination sets is
from the older Mac command keyboard combinations while the second set is the
older 3.1 and previous Windows keyboard combinations.

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000

"KLZA" wrote in message
ups.com...
You cannot stop users from copying/pasting in other apps via a macro
in excel or word. But you can disable copy/paste in excel via macro..
see below:

The code below must be placed in the Private Module of the Workbook
Object (ThisWorkbook). To get there easily, right click on the Excel
icon, top left next to File and choose View Code. In here paste the
code below, close & save and then re-open.

Private Sub Workbook_Activate()
Dim oCtrl As Office.CommandBarControl

'Disable all Cut menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = False
Next oCtrl

'Disable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = False
Next oCtrl

Application.CellDragAndDrop = False

End Sub

Private Sub Workbook_Deactivate()
Dim oCtrl As Office.CommandBarControl

'Enable all Cut menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = True
Next oCtrl

'Enable all Copy menus
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 = False
.CutCopyMode = False 'Clear clipboard
End With
End Sub
List of Excel 2000 CommandBar Button IDs applies to excel 97 onwards.

Found he http://www.ozgrid.com/VBA/disable-cut-copy.htm

On Aug 14, 3:41 pm, "Richard" wrote:
How can I stop users from using Copy/Paste in any application while my
macro
is running?

Or, can I use an isolated clipboard that's only available to Excel and
Word
and it's not affected by what users copy in other applications?

Regards,
Richard