• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to Protect a Workbook from SAVE

rcreek09

New Member
I feel like I'm overlooking something obvious, but I have searched Help, and Chandoo and can't find the answer!


I have a workbook with multiple sheets that is used to receive imported data. The data is manipulated, then a printout is done. Then the file SHOULD BE closed without saving, to be ready for the next import. Problem = different people use the file and without fail, users SAVE the file. Of course this ruins it.


Is there a way to just protect a workbook from being saved? The users need to import data, enter some data, maybe even make a few formatting changes. I don't care what they do with the file as long as they can't SAVE it.


What is the simple answer that I am overlooking because I am over-thinking it?


We have a mix of 2003 and 2010 users.

Thanks

Deb
 
Deb


Add the following code to the Workbook module in VBA (Alt F11)

[pre]
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End Sub
[/pre]
 
Deb

Why not just apply a password to the file

Set a Password to Modify and enable Read Only Recommended


This is accessed in 2007/2010 in the

File, Save As

Tools drop down

General Options
 
have you tried saving it as a read only recommended file, that way when they open it they open it in read only then do their import, get their print out and close it. to do this you can go to Save as, then click Tools near the save button, then click general options and select 'read only recommended'. if they try to save it will be a read only copy and they would have to change the name therefore not able to overwrite.
 
Hi, rcreek09!


Here's another approach to accomplish your issue. I don't know if it'll be suitable for you, but just in case...


Give a look at this file:

http://dl.dropbox.com/u/60558749/How%20to%20Protect%20a%20Workbook%20from%20SAVE%20%28for%20rcreek09%20at%20chandoo.org%29.xlsm


Used normally, it won't let anyone to neither save it nor save it as another filename. And that includes you too. For updating this file you should either disable macros or press and hold Shift key while opening it.


The only VBA code it has is this, placed in "ThisWorkbook" section:


-----

[pre]
Code:
Option Explicit

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
SaveAsUI = False
Cancel = False
ActiveWorkbook.Close False
End Sub
[/pre]
-----


Regards!
 
SirJB7


Option Explicit


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

SaveAsUI = False

Cancel = False

ActiveWorkbook.Close False

End Sub


-----


The Above formula is excellent if the author will enter some data and want save then it is not possible to save
 
Hi, sgmpatnaik!

The author (or whoever presses and holds shift key while opening the workbook) will be able to save it, not users that are not aware of this. I think I stated it clearly in my previous post.

Regards!
 
Ah Thank q sir


is it possible to protect the work book with multi users password to Open the Workbook


for ex.


owner - User id - xxxx

Pass word - xxxxxx


access for full work book


and user


user1 - user id - xxxxx

password - xxxxxxx


Note - He can view the workbook with specified ranges which we provide for the user
 
Hi, sgmpatnaik!

No, it's impossible, Excel has only one password. What you can build is a workbook with an automatically load and shown user form, and there you can simulate a UserId/Password combination for the number of users you want.

But you shouldn't get involved with those kind of things if you're not going to be able to maintain and update that stuff.

Regards!
 
Back
Top