I don't get it to work.
I use a userform for typing/asking for a PW with this code.
Private Sub CommandButton1_Click()
If TextBox1 <> "" Then
strPW = TextBox1
Unload Me
Else
MsgBox "U bent vergeten een wachtwoord in te voeren.", vbInformation, ""
TextBox1.SetFocus
End If
End Sub
For a lot of unlocking i wan't to use a PW placed somewhere central so i can change it easy.
And unlock a script lock this.
If shI.Range("P2") = "LOL" Then
shI.Range("P2") = ""
Application.ScreenUpdating = False
strPW = ""
Wachtwoord_check.Show
If strPW <> "" Then
If strPW = "Secret" Then
Dim wSheetName As Worksheet
For Each wSheetName In Worksheets
wSheetName.Unprotect Password:="Secret"
wSheetName.Visible = True
Next wSheetName
shI.Activate
Application.ScreenUpdating = True
MsgBox "Alle tabbladen zijn verschenen en ontgredeld.", vbInformation, ""
Else
MsgBox "Het wachtwoord is niet juist.", vbCritical, ""
End If
End If
Or script like this.
shp.Unprotect Password:="Secret"
LR = shp.Cells(Rows.Count, 2).End(xlUp).Row
LC = shp.Cells(5, Columns.Count).End(xlToLeft).Column
shp.ListObjects("PKB").Resize Range("$B$5", Cells(LR, LC))
shp.Protect Password:="Secret", UserInterFaceOnly:=True
But for one script i want to use another PW.
Sub Grenswaarden_aanpassen()
Application.ScreenUpdating = False
strPW = ""
Wachtwoord_check.Show
If strPW <> "" Then
If strPW = "Onsje meer" Then
Sheets("Invulblad").Unprotect "Secret"
Sheets("Invulblad").Range("F:J").Locked = False
Sheets("Invulblad").Protect Password:="Secret", UserInterFaceOnly:=True
MsgBox "U kunt de grenswaarden aanpassen.", vbInformation, ""
Else
MsgBox "Het wachtwoord is niet juist.", vbCritical, ""
End If
End If
Application.ScreenUpdating = True
End Sub
Is this even possible?
Bookmarks