用VBA代码+用户窗体 ,按Alt + F11进入编辑;确定按钮的代码:;
Private Sub CommandButton1_Click();
If TextBox1.Text = "123456" Then '密码为123456;
Application.Visible = False '隐藏工作簿;Unload Me ;
UserForm2.Show '下一步就是加载此用户窗体;
Else;If MsgBox("密码错误!是否重新输入?", vbYesNo, "登录失败:") = vbNo Then;MsgBox "您没有访问权限!!", 16;Unload Me;
Else;TextBox1.Value = "";
TextBox1.SetFocus;
End If;End If;End Sub;取消按钮的代码:;
Private Sub CommandButton2_Click();Unload Me;
End Sub