online 1
gast (50)

/ Forum / Tabellenkalkulation

TabellenkalkulationTabellenkalkulation

Fragevon Meikel vom 04.06.2019, 12:07 Options

Button in Userform springt auf "cancel"

Hallo zusammen,

ich bedarf mal wieder Eurer Hilfe.

Ich hab' eine Userform erstellt mit folgendem Code: siehe unten

Nachdem ich das Passwort engegeben habe springt der Cursor auf den Button "abbrechen" anstatt auf "ok"

Muß ich im Code etwas ändern?

Danke für Eure Unterstützung, Gruß meikel



Private Sub CommandButton1_Click()
If TextBox1 = "hallo" Then
Unload Me
intC = 0
Sheets("sheet1").Visible = True
Sheets("sheet1").Activate
Else
intC = intC + 1
If intC <= 2 Then
If MsgBox("Your password is wrong!", vbRetryCancel + vbExclamation, _
"Sorry") = vbCancel Then
Unload Me
Exit Sub
End If
TextBox1 = ""
TextBox1.SetFocus
Else
MsgBox "You have entered the wrong password thrice and " & vbLf & _
"your account has been locked!" & vbLf & vbLf & _
"The workbook will be closed!", vbOKOnly + vbExclamation, "Access denied"
ActiveWorkbook.Close
End If
End If
End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub


Antwort schreiben

Antwort 1 von Hajo_Zi vom 04.06.2019, 19:34 Options

Hallo Meikel,

hast Du mal mit rechter Maustaste die Aktivierungsreihenfolge geprüft?

Gruß Hajo

Antwort 2 von Meikel vom 04.06.2019, 20:29 Options

Hallo Hajo,

danke vielmals, das wars.

Viele Grüße, meikel

Ähnliche Themen

"Hyperlink einfügen"-Funktion im UserForm nutzen
Cuidas  26.02.2007 - 172 Hits -

Excel-Tabelle mit Visual basic verknüpfen
peter1234  20.06.2007 - 169 Hits -

Public-Variable von userform an Excel funktioniert nicht?
Marie  09.01.2008 - 41 Hits - 17 Antworten

Unload me funktioniert nicht !
Sara12345  18.04.2008 - 37 Hits - 4 Antworten

Hinweis

Diese Frage ist schon etwas älter, Sie können daher nicht mehr auf sie antworten. Sollte Ihre Frage noch nicht gelöst sein, stellen Sie einfach eine neue Frage im Forum..

Neue Einträge

Version: supportware 1.9.150 / 10.06.2022, Startzeit:Thu Jan 8 21:07:44 2026