ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Restricting rights to save a spreadsheet (https://www.excelbanter.com/excel-worksheet-functions/116938-restricting-rights-save-spreadsheet.html)

GeneR

Restricting rights to save a spreadsheet
 
I tried to save this once and received an error. I hope I didn't duplicate
my question.

I have a worksheet I created that imports data from one spreadsheet to
another, then runs several formula calculations on the retrieved data. I
want to be able to place in on our intranet and allow users to access it, but
not to be able to save any changes. I have restriced the cells, but also
want to restrict the worksheet so it cannot be saved to a hard drive or
anywhere else.

Ken Puls

Restricting rights to save a spreadsheet
 
Unfortunately, I don't believe that you can prevent the workbook from
being copied off your network. You can make it more difficult, by using
some VBA to prevent saving from within Excel, but this will have no
effect if someone wants to just copy the file when the workbook is
closed. (Baring, of course, and security that your network admins may
be able to set up.)

If you want to disable saving from within Excel, you could use the
following code to do so:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
If Not Application.UserName = "Ken Puls" Then Cancel = True
End Sub

Update my name to your username as defined in Tools|Options|General -
Usename. The code would go in the ThisWorkbook module of your VB
Project. To get it the

-Press Alt+F11 to enter the Visual Basic Editor
-Press Ctrl+R to display the explorer if it is not showing
-Find your project and drill into the ThisWorkbook module
-Paste the code there. Dont' forget to modify your username

This code means that only you will be able to save the workbook, and
then only if you are at a PC which uses the MS Office username I pointed
you to above. It will discard changes silently. You will also get
macro warnings from this point forward.

HTH,

Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca

GeneR wrote:
I tried to save this once and received an error. I hope I didn't duplicate
my question.

I have a worksheet I created that imports data from one spreadsheet to
another, then runs several formula calculations on the retrieved data. I
want to be able to place in on our intranet and allow users to access it, but
not to be able to save any changes. I have restriced the cells, but also
want to restrict the worksheet so it cannot be saved to a hard drive or
anywhere else.


Leandro

Restricting rights to save a spreadsheet
 
Hummmm. This macro did not work for me. All Save buttons are still activated.
Should not there be a "End If" in the code?

Gord Dibben

Restricting rights to save a spreadsheet
 
Leandro

Ken's code does not hide or make unavailable the Save buttons.

It just cancels any Save if user name is not correct.

Doesn't need an "End If"

Stick one in and see what happens just for your own edification.


Gord Dibben MS Excel MVP

On Sat, 18 Nov 2006 14:58:01 -0800, Leandro
wrote:

Hummmm. This macro did not work for me. All Save buttons are still activated.
Should not there be a "End If" in the code?




All times are GMT +1. The time now is 11:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com