Unable to prevent copy/paste of protected worksheet into new docum

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm working on a price list which contains confidential information, i.e.
costs, which i have protected. Even when locked, if i select the entire
worksheet and copy, i can paste it in another document and everything hidden
and protected on the original document is now completely available.
How can this be secure??
 
try this
Sub protectActiveSheet()
Dim myPassword As String
ActiveSheet.Select
ActiveSheet.Copy
'Change 123456 to your password
myPassword = "123456"

ActiveSheet.Protect myPassword, True
End Sub
 
JMB,
Thanks for your quick reply. Do you have any suggestions on how a can
achieve what i want to do?
 
I don't know if i'm doing something wrong but it still doesn't work!
Any advice?
 
Hi,

You can try this one :
Sub DisableCopy()
'disable every copy button
For Each ctl In Application.CommandBars.FindControls(ID:=19)
ctl.Enabled = 0
Next ctl

'disable copy button in the Edit menu
Application.CommandBars(1).Controls(2).FindControl(ID:=19).Enabled = 0

'disable Ctrl+C
Application.OnKey "^c", ""
End Sub

if you want to enabled them again change .Enabled = 1
and
change Application.OnKey "^c", "" to Application.OnKey "^c"
 
Sory should be add 'On error resume next' before code...
Sub DisableCopy()
On Error Resume Next
For Each ctl In Application.CommandBars.FindControls(ID:=19)
ctl.Enabled = 0
Next ctl
Application.CommandBars(1).Controls(2).FindControl(ID:=19).Enabled = 0
Application.OnKey "^c", ""
End Sub
 
Thanks much Halim.
It works well. However, do you know how to hide or prevent macros from being
seen or edited?

Thanks again!

Richard R.
 
Well, i found something else: Kalim's suggestion worked. However when the
macro disable the copy fonction, it doesn't turn it back on when you close
the workbook. How can this be avoid?

Any help will be much appreciated.

Thanks,

Richard R.
 
You could protect the VBA project. In the VBA editor, right click your
project, select properties, and enter a password. After you save and reopen
it should ask for the password before viewing the project.

Of course, worksheet protection and VBA project protection are easily
removed (depending on how much effort your users want to put into cracking
it). There is also third party software readily available to crack excel's
passwords.

Here's a thread regarding VBA protection:
http://www.microsoft.com/office/com...5298&catlist=&dglist=&ptlist=&exp=&sloc=en-us

Also, if you use code to disable the copy feature, remember that the code
doesn't run if the user sets the security to high.
 
You could protect the VBA project. In the VBA editor, right click your
project, select properties, and enter a password. After you save and reopen
it should ask for the password before viewing the project.

Of course, worksheet protection and VBA project protection are easily
removed (depending on how much effort your users want to put into cracking
it). There is also third party software readily available to crack excel's
passwords.

Here's a thread regarding VBA protection:http://www.microsoft.com/office/community/en-us/default.mspx?query=vb...

Also, if you use code to disable the copy feature, remember that the code
doesn't run if the user sets the security to high.








- Show quoted text -

Hi,

Since we have the code to disable copy function, how to modify it to
disable "cut" function in the standard tool bar menu?

Thanks,

G
 
Using Halim's macro - I think you need to change the ID to 21 and the hotkey
to "x"

Sub DisableCopy()
Dim ctl As CommandBarControl
On Error Resume Next
For Each ctl In Application.CommandBars.FindControls(ID:=21)
ctl.Enabled = 0
Next ctl
Application.CommandBars(1).Controls(2).FindControl(ID:=21).Enabled = 0
Application.OnKey "^x", ""
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

Back
Top