作者:乔山办公网日期:
返回目录:excel表格制作
首先建立一个用户窗体UserForm1做为登录窗zhidao,设置两个文本框内TextBox1和TextBox2,一个确定按钮,CommandButton1。代码如下
Private Sub CommandButton1_Click()
If TextBox1.Value = "管理员" And TextBox2.Value = "123" Then
Me.Hide
Sheets("sheet1").Select
Else
ThisWorkbook.Application.Quit
End If
End Sub
在thisworkbook项输入如下代码,就在打开文容档时弹出登录窗。
Private Sub Workbook_Open()
UserForm1.Show 0
End Sub
最简单快捷的方法是设置密码