模块1:OptionExplicitPublicconAsADODB.ConnectionPublicrsAsADODB.RecordsetPublicusernameAsStringPublicusergradeAsStringPublicuserpwdAsStringPubliccmdAsADODB.Command模块2OptionExplicitSubhidewindow()WithActiveWindow.DisplayGridlines=False.DisplayHeadings=False.DisplayOutline=False.DisplayZeros=False.DisplayHorizontalScrollBar=False.DisplayVerticalScrollBar=False.DisplayWorkbookTabs=FalseEndWithEndSubSubshowwindow()WithActiveWindow.DisplayGridlines=True.DisplayHeadings=True.DisplayOutline=True.DisplayZeros=True.DisplayHorizontalScrollBar=True.DisplayVerticalScrollBar=TrueEndWithEndSub模块3:SubMacro1()Range(D2:D60000).SelectWithSelection.Validation.Delete.AddType:=xlValidateList,AlertStyle:=xlValidAlertStop,Operator:=_xlBetween,Formula1:=团员,党员,预备党员,群众.IgnoreBlank=True.InCellDropdown=True.InputTitle=.ErrorTitle=.InputMessage=.ErrorMessage=.IMEMode=xlIMEModeNoControl.ShowInput=True.ShowError=TrueEndWithEndSubSubMacro2()Range(J2:J60000).SelectWithSelection.Validation.Delete.AddType:=xlValidateList,AlertStyle:=xlValidAlertStop,Operator:=_xlBetween,Formula1:=本科,专科.IgnoreBlank=True.InCellDropdown=True.InputTitle=.ErrorTitle=.InputMessage=.ErrorMessage=.IMEMode=xlIMEModeNoControl.ShowInput=True.ShowError=TrueEndWithEndSubSubMacro3()Range(K2:K60000).SelectWithSelection.Validation.Delete.AddType:=xlValidateList,AlertStyle:=xlValidAlertStop,Operator:=_xlBetween,Formula1:=在校,休学,毕业.IgnoreBlank=True.InCellDropdown=True.InputTitle=.ErrorTitle=.InputMessage=.ErrorMessage=.IMEMode=xlIMEModeNoControl.ShowInput=True.ShowError=TrueEndWithEndSubUserForm1代码:OptionExplicitPrivateSubCommandButton1_Click()OnErrorGoTodoerrorDimsqlAsStringSetcon=NewADODB.ConnectionSetrs=NewADODB.Recordsetcon.OpenProvider=Microsoft.Jet.OLEDB.4.0;Datasource=&ThisWorkbook.Path&\xjcj.mdbsql=select*from用户数据表where用户名='&UserForm1.ComboBox1.Text&'rs.Opensql,con,adOpenKeyset,adLockOptimisticIfUserForm1.ComboBox1.Text=ThenMsgBox用户名不能为空!UserForm1.ComboBox1.SetFocusExitSubEndIfIfUserForm1.TextBox2.Text=ThenMsgBox密码不能为空!UserForm1.TextBox2.SetFocusExitSubEndIfIfTrim(rs.Fields(密码))=Trim(UserForm1.TextBox2.Text)Thenusername=Trim(rs.Fields(用户名))usergrade=Trim(rs.Fields(权限))userpwd=Trim(rs.Fields(密码))Workbooks.Application.Visible=TrueSheets(目录).ActivateMe.HideUnloadMeElseMsgBox密码错误TextBox2.Text=TextBox2.SetFocusExitSubEndIfrs.Closecon.CloseSetrs=NothingSetcon=NothingExitSubdoerror:MsgBox系统出现错误EndSubPrivateSubCommandButton2_Click()ActiveWorkbook.SaveApplication.QuitEndSubPrivateSubUserForm_Initialize()DimiAsIntegerSetcon=NewADODB.ConnectionSetrs=NewADODB.Recordsetcon.OpenProvider=Microsoft.Jet.OLEDB.4.0;Datasource=&ThisWorkbook.Path&\xjcj.mdbrs.Openselect*from用户数据表,con,adOpenKeyset,adLockOptimisticFori=1Tors.RecordCountUserForm1.ComboBox1.AddItemrs.Fields(用户名)rs.MoveNextNextirs.Closecon.CloseSetrs=NothingSetcon=NothingEndSubUserForm2代码:OptionExplicitPrivateSubCommandButton1_Click()OnErrorResumeNextApplication.ScreenUpdating=FalseDimsqlAsStringSetcon=NewADODB.ConnectionSetrs=NewADODB.RecordsetSetcmd=NewADODB.Commandcon.OpenProvider=Microsoft.Jet.OLEDB.4.0;Datasource=&ThisWorkbook.Path&\xjcj.mdbSetcmd.ActiveConnection=conIfUserForm2.TextBox1.Text=OrUserForm2.TextBox2.Text=OrUserForm2.TextBox3.Text=ThenMsgBox更改信息不齐全!,48ExitSubEndIfIfuserpwd=Trim(UserForm2.TextBox1.Text)ThenIfTrim(UserForm2.TextBox2)=Trim(UserForm2.TextBox3)Thencmd.CommandText=update用户数据表set密码='&UserForm2.TextBox2.Text&'where用户名='&username&'cmd.ExecuteMsgBox密码更换成功!请牢记密码!UnloadMeElseMsgBox确认密码输入有误,请重新输入!UserForm2.TextBox3.SetFocusEndIfElseMsgBox原密码输入错误,请重新输入!UserForm2.TextBox1.SetFocusEndIfApplication.ScreenUpdating=Truers.Closecon.CloseSetrs=NothingSetcon=NothingEndSubPrivateSubCommandButton2_Click()UnloadMeEndSubUserForm3代码:OptionExplicitPrivateSubCommandButton1_Click()OnErrorResumeNextDimyAsIntegerSetcon=NewADODB.ConnectionSetrs=NewADODB.RecordsetSetcmd=NewADODB.Commandcon.OpenProvider=Microsoft.Jet.OLEDB.4.0;Datasource=&ThisWorkbook.Path&\xjcj.mdbrs.Openselect*from用户数据表where用户名='&UserForm3.TextBox1.Text&',con,adOpenKeyset,adLockOptimisticIfUserForm3.TextBox1.Text=OrUserForm3.TextBox2.Text=OrUserForm3.TextBox1.Text=ThenMsgBox信息不全,请完整填写信息ExitSubEndIfIfNotrs.EOFThenMsgBox用户名已存在,请重新输入ExitSubElseSetcmd.ActiveConnection=concmd.CommandText=INSERTINTO用户数据表(用户名,密码,权限)VALUES('&Trim(UserForm3.TextBox1.Text)&','&Trim(UserForm3.TextBox2.Text)&','&Trim(UserForm3.ComboBox1.Text)&')cmd.Executey=MsgBox(数据保存成功,是否继续增加,vbYesNo,提示信息!)Ify=vbYesThenWithUserForm3.TextBox1.Text=.TextBox2.Text=.ComboBox1.Text=.TextBox1.SetFocusExitSubEndWithElseIfy=vbNoThenUnloadMeExitSubEndIfEndIfrs.Closecon.CloseSetrs=NothingSetcon=NothingEndSubUserForm4代码:OptionExplicitPrivateSubCommandButton1_Click()OnErrorResumeNextDimyAsStringDimcmdAsADODB.CommandSetcon=NewADODB.ConnectionSetrs=NewADODB.RecordsetSetcmd=NewADODB.Commandcon.OpenProvider=Microsoft.Jet.OLEDB.4.0;Datasource=&ThisWorkbook.Path&\xjcj.mdbSetcmd.ActiveConnection=conIfTrim(username)=Trim(UserForm4.ComboBox1.Text)ThenMsgBox当前用户不能删除ExitSubEndIfy=MsgBox(您是否真的删除该用户?,vbYesNo+64,提示)Ify=vbYesThencmd