Im doing a spreadsheet for my A Level ICT coursework and have multiple sheets that are hidden from view unless a password is entered (all other routes to unhiding sheets are locked out). At the moment the password can only be changed if a user changes it in the Visual BASIC editor.
As you can see, the password is stored on a different form (chngpass) I wish to use this form to enable the "admin" to change the password without the hassle of the VB editor. I have used "Nested If" statements (if thats what they are called in VB) to validate the original password and the new/repeated passwords before allowing any change, the only problem that I am unable to work around is permenantly changing the value of the text box that the password is stored in, as it just resets when it closes. Can someone help me by sending a line of code that will work around this problem if it exists?VB Code:
Private Sub ok_Click() If password = chngpass.key Then Unload Me Correct.Show ActiveWorkbook.Unprotect Sheets("PaySlips").Visible = True Sheets("Shifts").Visible = True Sheets("Shifts").Select Application.DisplayFormulaBar = True Application.ActiveWindow.DisplayWorkbookTabs = True Else Unload Me wrong.Show End If End Sub
Thanks in advance,
Craig.




Reply With Quote