preventing copying

M

mattguerilla

Hi,

How do I prevent someone copying data from cells in excel? I am using excel
2000.

regards,

Matt
 
A

Ardus Petus

Paste the following in ThisWorkbook code:

HTH
--
AP

'-----------------------
Private Sub Workbook_Open()
setCutCopy False
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
setCutCopy True
End Sub


Sub setCutCopy(bSet As Boolean)
Const iIdCopy = 19
Const iIdCut = 21
CommandBars("Standard").FindControl(ID:=iIdCopy).Visible = bSet
CommandBars("Edit").FindControl(ID:=iIdCopy).Visible = bSet
CommandBars("Cell").FindControl(ID:=iIdCopy).Visible = bSet

CommandBars("Standard").FindControl(ID:=iIdCut).Visible = bSet
CommandBars("Edit").FindControl(ID:=iIdCut).Visible = bSet
CommandBars("Cell").FindControl(ID:=iIdCut).Visible = bSet

If bSet Then
Application.OnKey "^c"
Application.OnKey "^x"
Else
Application.OnKey "^c", ""
Application.OnKey "^x", ""
End If
End Sub
'----------------------------
 
D

Dave Peterson

Just to add to Arvi's response.

Excel's security isn't made for this kind of protection.

You could try implementing the code that Ardus supplied, but if the user
disables macros or even resets his toolbar, then your data can be copied.
 
Top