![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 95
|
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.
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
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) |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,387
|
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 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|