VBA. (UserForm_Initialize
) RunSub/UserForm.
. . , UserForm_Initialize.
,
1) Private . ;
2) Show , , . , UserForm_Initialize, , :
Sub ()
frm.Show
End Sub
UserForm_Initialize, .
(TextBox) (Label).
(TextBox) (Label) .
1. :
. 10‑8.
2. 7 .
3. .
4. !, .
5. OK.
6. .
7. [Enter], [Escape].
1) :
cmdOK
cmd
txt
2) frm.
:
1. VBA (. 10‑9) frm:
. 10‑9.
2. OK .
3. . txt.
4. , , :. . , , Caption ( :).
5. . ( Private SubUserForm_Click()), Initialize, :
Private Sub UserForm_Initialize()
cmdOK.Default = True
cmd.Cancel = True
With txt
.PasswordChar = "*"
|
|
. MaxLength = 7
End With
End Sub
6. cmdOK OK:
Private Sub cmdOK_Click()
Dim As String
' , :
= "Student"
If txt.Text = LCase() Then
MsgBox " ! "
Unload Me
Else
With txt
.Text = Empty
.SetFocus
End With
End If
End Sub
7. cmd :
Private Sub cmd_Click()
Unload Me
End Sub
8. .
SetFocus, // . , , txt . , .