Private Sub CommandButton1_Click() Dim name As String Dim pw As String name = ComboBox1.Value pw = TextBox1.Value If name <> "lp" Or pw <> "fy" Then MsgBox "用户名或密码不正确,请重新输入!", 64 TextBox1.SetFocus Else MsgBox "用户名及密码正确,请继续!", 64 Unload UserForm1 '关闭窗体 Application.Visible = True '显示工作表 End If End Sub