|
楼主 |
发表于 2010-7-15 14:43
|
显示全部楼层
回复 31楼 lzqlaj 的帖子
问题解决,原因是关闭工作薄时并没有结束EXCEL进程,故第二次打开会避开登陆窗口(系程序自动化故障),解决办法是修改两处代码,如下
①在ThisWorkbook 中找到Private Sub Workbook_BeforeClose(Cancel As Boolean) 修改为:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
xscdml
hfhml
WbBuiltin
Application.EnableEvents = False '关闭并保存文件
Application.Quit '关闭Excel
ThisWorkbook.Save
ThisWorkbook.Close True '活动工作薄关闭,不保存
Application.DisplayAlerts = True
Application.EnableEvents = True 'EXCEL程序退出
End Sub
②找到窗体 Login 代码 中的CommandButton1_Click() '''''''系统登陆确定按钮,修改为
Private Sub CommandButton1_Click() '''''''系统登陆确定按钮
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheet36.Range("A2").Value = Me.ComboBox1.Text
If Me.TextBox1.Text = Sheet36.Range("B2").Value Then
MsgBox Me.ComboBox1 & " ,欢迎你使用本系统!", vbInformation, "系统提示"
Unload Login
Unload frmFace
Application.Visible = True
Else
MsgBox "密码错误,你无权使用本系统!", vbExclamation, "系统提示"
Application.Quit
ThisWorkbook.Close savechanges:=False
End If
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
[ 本帖最后由 zy040059 于 2010-7-15 14:48 编辑 ] |
|