excel不正确closures – userform挂?

我有一个包含6个用户表单的电子表格,用在大约30台电脑上。 VBA代码是密码保护的。 通常,当我们closures工作表时,VBA项目密码框出现,excel.exe保留在任务pipe理器中。

我做了一些testing,并拿出以下内容:

  1. 问题只发生在一个用户窗体打开。
  2. 用户窗体除了按取消(调用Unload Me)之外不需要做任何事情,

Workbook_BeforeClose事件如下所示:

Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.ScreenUpdating = False 'Cancel autosave Sheets("BOH General").Range("A102").Value = 0 AutoSaveTimer 'Application.EnableEvents = False If Not Sheets("START").Visible = True Then Call CostingMode Call BackItUp 'Application.EnableEvents = True Application.ScreenUpdating = True End Sub 

以下是由Workbook_BeforeClose调用的其他一些macros:

 Sub AutoSaveTimer() If Sheets("BOH General").Range("A102").Value > 0 Then RunWhen = Now + TimeSerial(0, Sheets("BOH General").Range("A102").Value, 0) Application.OnTime EarliestTime:=RunWhen, Procedure:="AutoSaveIt", _ Schedule:=True Else On Error Resume Next Application.OnTime EarliestTime:=RunWhen, Procedure:="AutoSaveIt", _ Schedule:=False On Error GoTo 0 End If End Sub Sub AutoSaveIt() ThisWorkbook.Save Call AutoSaveTimer End Sub Sub BackItUp() 'Dont run if unsaved If Sheets("BOH General").Range("A111").Value = "" Then Exit Sub 'Prompt If MsgBox("Do you want to backup this sheet now (recommended if you made any changes)?", vbYesNo) = vbNo Then Exit Sub 'reformat date Dim DateStamp As String DateStamp = Format(Now(), "yyyy-mm-dd hh-mm-ss") On Error Resume Next MkDir ActiveWorkbook.Path & "\" & "Backup" On Error GoTo 0 ActiveWorkbook.SaveCopyAs (ActiveWorkbook.Path & "\" & "Backup" & "\" & ActiveWorkbook.Name & " - backup " & DateStamp & ".xlsb") ActiveWorkbook.Save End Sub 

这是一个用户表单错误,用户表单不正确closures? 或者是别的什么?

更新:此错误只发生在用户单击Excelclosuresbutton(右上angular)单击文件>closures不会产生错误。

有趣的是,我也经历过同样的事例,最近也只是出现了。 MOS版本是否改变了这种行为? 我有Excel 12.0.6611.1000和12.0.6712.5000的用户不会得到这个错误,在12.0.6729.5000它总是发生。

编辑; 在发现有几个用户安装了“Drop Box”之后,我今天终于解决了这个问题。 在closures应用程序之前卸载或closures下拉框可解决问题。