Password protection protection!

Status
Not open for further replies.

Andy Gee

New Member
Joined
Feb 26, 2002
Messages
48
I have some password protected worksheets which need to be shared with various users to enter data. Sometimes people find it ammusing to change the password! Is there a way I can stop them from changing the password?

Any help please as it takes hours to crack the password and I can't stop people doing it!
This message was edited by Andy Gee on 2002-02-27 07:08
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I put form buttons on the sheet to lock and unlock, the password is hardcoded into the VBA code and hidden. This way the user cannot change the password.

This code gos on the sheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
'
' Macro by Joseph S. Was
'
Application.EnableEvents = False

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="admin"
Application.EnableEvents = True
End Sub

This code gos on the module:

Sub myUnLock()
'This code will unprotect the sheet.
Application.EnableEvents = False
Application.DisplayAlerts = False
ActiveSheet.Unprotect ("admin")

'Add optional code here!

Application.EnableEvents = True
Application.DisplayAlerts = True

End Sub

This is a very simple form of this.
If this is the route you want to try, I have some very complex systems? JSW
This message was edited by Joe Was on 2002-02-27 08:58
 
Upvote 0
This is very usefull and I'm sure I'll use it in the future but it dosent help with those folks changing the main password when they save the workbook. Is there a way I could disable the 'save as' option? thus bypassing the point where the canges to the password can be made?
 
Upvote 0
Andy,

Use the code below (open VBE and place in "Thisworkbook" object):

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, cancel As Boolean)
If SaveAsUI Then
cancel = True
End If
End Sub

This prevents users from using "Save As" with this file, thus not allowing them to change the password. Hope this helps.

Aloha!

p.s. Also, be sure to password protect your vba code so that people can't go into VBE and disable this. (VBE Menu Bar: Tools | VBAProject Properties, Protection tab).
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,213,530
Messages
6,114,163
Members
448,554
Latest member
Gleisner2

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