Some simple questions concerning Protection, and File/Save

Angelo Dundee

Board Regular
Joined
Nov 18, 2002
Messages
167
:pray:
Can someone plaese help
1) If i have a spreadsheet program which consists of a few sheets, do I have to protect each one individually, or is there a simple way of protecting all of them ?
2) What does the Protect Workbook command do, as oppose to the Protect Worksheet command ?
3) How can I stop the master spreadsheet program, from saving onto itself, i.e.
a) I want to prevent the user from using the File/Save command
b) I want to prevent the user from using the File/Save As command/ then choosing the same file name
In order to prevent the master copy from disappearing ?

:eek: Thanks !
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Re: Some simple questions concerning Protection, and File/Sa

What version of Excel are you using ??

(y)
 
Upvote 0
Re: Some simple questions concerning Protection, and File/Sa

To answer some of your questions:

http://j-walk.com/ss/excel/usertips/tip022.htm
http://j-walk.com/ss/excel/faqs/protectionFAQ.htm

and a couple of specimen macros to unprotect/reprotect all sheets

Code:
Sub ProtectAllSheets()
Dim x
For x = 1 To Sheets.Count
Sheets(x).Protect ("password")
Next x
End Sub

Sub UnProtectAllSheets()
Dim x
For x = 1 To Sheets.Count
Sheets(x).Unprotect ("password")
Next x
End Sub

HTH
 
Upvote 0
Re: Some simple questions concerning Protection, and File/Sa

Just found this in my personal.xls to disable saveas - can't remember who wrote it though!

Goes in the ThisWorkbook module and obviously requires macros to be enabled

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Select Case True
Case SaveAsUI
MsgBox "Sorry, you may not ''Save as'' this workbook." & vbCrLf & vbCrLf & "You may only save it, _ keeping its original name.", 48, "''Save as'' not allowed."
Cancel = True
Case Else
Exit Sub
End Select
End Sub

HTH also
 
Upvote 0
Re: Some simple questions concerning Protection, and File/Sa

With regard to the last part of your question, in the "save as" menu select "tools" then "general options" you can add a password to allow modification. Otherwise the user would have to open as read only. I think that should work
 
Upvote 0
Re: Some simple questions concerning Protection, and File/Sa

Santeria, I am using 2002

Any help you can giv me will be greatly appreciated.

Thanks, A. D.

'nobody is unbeatable, not even Foreman.'
 
Upvote 0
Re: Some simple questions concerning Protection, and File/Sa

The difference with the Protect workbook command is that it only prevents the following:

workbook window from resizing and movement
adding/deleting/renaming/moving/hiding/unhiding worksheets,
 
Upvote 0
Re: Some simple questions concerning Protection, and File/Sa

Iridium, thanks for your help.

That is similar to what I want to do, however, your solution does the opposite of what i want to do, i.e.
I want the user to be prevented from using the Save command ( not the Save As command ! ), also
I want the user to be prevented from using the Save As command / followed by the current filename ( this is obviosly the same as Save )

What is the code to do both of these things ?
:rolleyes: :pray: :oops:
 
Upvote 0
Re: Some simple questions concerning Protection, and File/Sa

I'm no VBA guru by the way but try this:

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 
    Cancel = True 
End Sub

Not sure though... Post back if I've ****ed up
 
Upvote 0
Re: Some simple questions concerning Protection, and File/Sa

Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim fname
    Select Case SaveAsUI
        Case True
            fname = Application.GetSaveAsFilename
            If InStr(1, UCase(fname), UCase(ThisWorkbook.Name)) Then
            MsgBox "Sorry, you may not save as the existing name."
            End If
            Cancel = True
            Exit Sub
        Case False
            Cancel = True
            MsgBox ("Ya can't save to there from here")
            Exit Sub
    End Select
End Sub

p.s. Iridium is one of the many guru's here I've relied on to learn this stuff in the past few months so don't listen to his modesty.
 
Upvote 0

Forum statistics

Threads
1,203,691
Messages
6,056,756
Members
444,889
Latest member
ibbara

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