Wie kann ich den Zugriff auf ein bestimmtes Tabellenblatt in Excel mit Hilfe von einem Benutzername und Passwort verhindern?
Geht das via VBA oder auch anderweitig?
Danke
Gruß
Norbert
Private Sub UserForm_Activate()
'Vorbelegung mit Anmeldename, kann auch weg
TextBox1 = Environ("Username")
End Sub
Private Sub CommandButton1_Click() 'OK
If TextBox1 = "Max" And TextBox2 = "Geheim" Then
Unload UserForm1
MsgBox "Hallo " & TextBox1 & vbLf & "Du hast Zugriff auf das Blatt."
'hier jetzt das Blatt entsperren
ActiveSheet.Unprotect Password:="ABC"
Else
With ActiveSheet
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="ABC"
.EnableSelection = xlNoSelection
End With
Unload UserForm1
MsgBox "Benutzer oder Passwort falsch"
End If
End Sub
Private Sub CommandButton2_Click() 'Abbrechen
Unload UserForm1
End Sub
Private Sub Worksheet_Activate()
UserForm1.Show
End Sub
Private Sub Worksheet_Deactivate()
Me.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="ABC"
Me.EnableSelection = xlNoSelection
End Sub
https://www.herber.de/bbs/user/99038.xlsm
Sub onon()
Application.EnableEvents = True
End Sub
Gruß UweD
Sub onon()
Application.EnableEvents = True
End Sub
dies hat auch nichts gebracht