Copy and paste prevention

trillicomm

Board Regular
Joined
Feb 24, 2002
Messages
101
I have an excel file of 7000 rows and 10 columns of sensitive information. But can I do something in VBA or Excel to prevent and copying and pasting the cells to a new file when the file is open by a client? They can print screen is the only way to capture the information.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
You would have to disable all of the copy and paste commands from the menus using VBA. (this includes the commands on the right-click menu and the "Edit" menu) If you search the message board you should be able to find an example of something similar. I've seen this asked recently.

You could also disable the CTRL+C and CTRL+V key combos using the VBA "Onkey" command. (See VBA help for details)
 
Upvote 0
Try pasting any or all this (depending on your level of desired control) into your workbook module. You don't need every Sub here, so pick and choose what works best for you.

Keep in mind 2 points:
(1) This will disable your Undo capabilities.
(2) There is no such thing as an uncircumventable security measure. In other words, this code is not the be all end all...it will only stop your friends.

''''''''''''''''''''''''''''''''''''''''

Private Sub Workbook_Activate()
With Application
.CutCopyMode = False
.CellDragAndDrop = False
End With

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Cancel = True
MsgBox "Right click menu deactivated." & vbCrLf & _
"Cannot copy or ''drag & drop''.", 16, "For this file:"
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
With Application
.CellDragAndDrop = False
.OnKey "^c", ""
.CutCopyMode = False
End With
End Sub

Private Sub Workbook_Deactivate()
With Application
.CellDragAndDrop = True
.OnKey "^c"
.CutCopyMode = False
End With
End Sub

'''''''''''''''''''''''''''''''''''''''''

_________________
Tom Urtis
This message was edited by Tom Urtis on 2002-03-20 05:16
 
Upvote 0

Forum statistics

Threads
1,214,422
Messages
6,119,396
Members
448,891
Latest member
tpierce

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top