disable copy & paste

S

sean

Hi,
I would be very much thankful if someone could help me.Ok,
let's us share this,if you want to prevent someone to save
your workbook to another name, you can simply do the
following and it is written in Private Module of the
Worksheet as follows:-

Private Sub Workbook_BeforeSave _
(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
If SaveAsUI = True Then Cancel = True
End Sub

This prompts me to ask you how if I want to prevent the
workbook from being copied as the"protected" hidden rows
can be viewed once the workbook is copied to another new
workbook,right? and the crucial part is that the hidden
rows contain confidential data($$$)...Anyone can help?

Sean Yeap
 
M

Mike

Excel security is very limited, so it's virtually
impossible to prevent people from copying data. One thing
that will work (sometimes), is this:

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.CutCopyMode = False
End Sub

If someone copies any range, then switches to another
workbook, then the clipboard is cleared. This won't work
if someone copies from the book and switches to another
application to paste (ie notepad, or another instance of
Excel). Also nothing you do will work if a person
disables macros.

Another way would be to hide the entire sheet using
xlVeryHidden. This way you can't even see it from
Format/Sheet/Unhide, let alone copy it. If you put this
in a macro, then you should password protect the project
to prevent people from seeing this line of code.
Sheets("Sheet1").Visible = xlVeryHidden
 
S

sean

Dear Arvi Laanemets,
Yes,thanks for the tip.Something like the following:-
Private Sub Worksheet_Activate()
Me.Visible = xlSheetVeryHidden
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
Me.Visible = xlSheetVeryHidden
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top