Question:
Disable right click in Excel 2003 worksheet?
Steve
15 years ago
I wanted to protect a worksheet from any form of electronic copying of data. The sheet is protected from selecting cells, but I wanted to disable right clicking so they could not simply just copy and paste into a word doc or such. I know I can use a macro to prevent right clicks....but...
Explain to me how this protects your document when all you have to do is click disable macros when it loads and you can still right click...????
This makes all macros useless as security of any kind...anybody can open the file and click disable macros and poof....you can right click and copy the whole thing...
Is there any way to really protect your data from electronic copying??
Thanks for any advice anyone can give me...
Three answers:
garbo7441
15 years ago
There are more ways to copy a worksheet/workbook than just right clicking. Save As, Copy/Paste, Move or Copy..., Save Workspace, Cut/Paste, Save as Web Page, etc.



You can protect you workbook, as Cosmosis said, by hiding all your sheets except a warning sheet and have a Workbook_Open macro to show the hidden sheets and hide the 'warning' sheet. However, unless the sheets are 'very hidden' anyone could make them visible after opening the workbook.



First, add a sheet named 'Warning', and in large text in the body just put 'Macros must be enabled for proper worksheet functionality'. Then, copy and paste these three macros into the 'This Workbook' module in your workbook. If you want the user to be able to use print preview and print functions, remove the code lines preventing this. Also, password protect the VBE.



Private Sub Workbook_Open()

Dim ws As Worksheet

For Each ws In Worksheets

ws.Visible = True

Next

Sheets("Warning").Visible = False

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Print Pre&view"). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("&Print..."). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("&Save"). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Save &As..."). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Save As Web Pa&ge..."). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Save &Workspace..."). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Sen&d To"). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("Edit").Controls("Cu&t"). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("Edit").Controls("&Copy"). Enabled = False

Application.CommandBars("Worksheet menu bar"). _

Controls("Edit").Controls("&Move or Copy Sheet..."). Enabled = False

Application.CommandBars("PLY"). _

Controls("&Move or Copy...").Enabled = False

Application.CommandBars("standard"). Enabled = False

End Sub



Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim ws As Worksheet

Sheets("Warning").Visible = True

For Each ws In Worksheets

If ws.Name <> "Warning" Then

ws.Visible = xlSheetVeryHidden

End If

Next

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Print Pre&view"). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("&Print..."). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("&Save"). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Save &As..."). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Save As Web Pa&ge..."). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Save &Workspace..."). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("File").Controls("Sen&d To"). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("Edit").Controls("Cu&t"). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("Edit").Controls("&Copy"). Enabled = True

Application.CommandBars("Worksheet menu bar"). _

Controls("Edit").Controls("&Move or Copy Sheet..."). Enabled = True

Application.CommandBars("PLY"). _

Controls("&Move or Copy...").Enabled = True

Application.CommandBars("standard"). Enabled = True

End Sub



Private Sub Workbook_SheetBeforeRightClick(ByVal sh As Object, _

ByVal Target As Range, Cancel As Boolean)

Cancel = True

End Sub
Cozmosis
15 years ago
Have all your sheets hidden and have the same macro that prevents right-clicks also unhide your sheets. If they choose not to enable macros, the sheets will remain hidden and they can't copy data from them.



You will also have to hide and protect your macros. So they can't be edited.
anonymous
9 years ago
double click mouse set up. formulas ctrl key hold it and and push ~key it usually behind the tab key and upper key 1


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...