VBA密码提示closuresExcel时

我有一个Workbook_Open代码加载用户窗体的工作表。 closures窗体和工作簿后,Excel提示我inputVBA项目密码。
我在这个页面上发现了关于这个问题的一些信息:
http://support.microsoft.com/kb/280454
http://social.msdn.microsoft.com/Forums/office/en-US/8cb79e54-26ae-487c-8945-69b84b2e4eeb/com-addins-and-vba-password-prompt-bug

但是,这似乎是COM加载项,我有一些问题。 问题是,加载项不是我的,我不能更改或禁用它们。

有没有其他解决scheme?

对我来说,问题不是一些加载项或未发布的引用。 这是Dropbox徽章。 一旦我将其删除,当我closuresExcel时,密码不再被请求。 要禁用Dropbox徽章,请打开Dropbox应用程序,转到设置,然后select首选项,然后在常规选项卡中selectDropbox徽章下的“从不显示”。 我在以下论坛上find了此解决scheme: https : //www.excelforum.com/excel-programming-vba-macros/1100960-ever-annoying-vba-password-prompt-at-close-of-excel-2.html

我有一些工作簿遇到与一些用户相同的问题。 我们经历了检查COM加载项以及Windows和Office的各种组合的过程。

最后,我们将下面的代码作为workbook_beforeclose事件的一部分,并为我们的用户解决了问题。

Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim intResponse as Integer 'If the workbook needs to be saved then ask the user if they want to save the workbook, if not then exit without saving 'Need a global boolean to ensure the request to save the workbook is not shown twice If Not ThisWorkbook.Saved And Not blnStartedClose Then blnStartedClose = True intResponse = MsgBox("Do you want to Save the this Workbook" & vbNewLine & vbNewLine & _ "Select 'Yes' to save the workbook" & vbNewLine & _ "Select 'No' to close without saving", vbYesNo, "Confirm - Workbook Save?") If intResponse = vbYes Then ThisWorkbook.Save End If 'If the user has clicked on 'No' to save the workbook then reset the "Saved" property to TRUE so that when we exit this routine no attempt to save the workbook is made ThisWorkbook.Saved = True End Sub 

当你有指向对象的指针时会发生这种情况。 对于VBA中的每个“Set xyz =”,确保你有一个对应的“Set xyz = Nothing”。 对于指向或从COM对象获取的任何东西也是如此。 确保closures任何ADO连接等。要特别小心处理所有错误,以便在工作簿closures之前将所有对象variables设置为Nothing,这些行包括:

 Option Explicit Option Compare Text Public Sub Refresh() On Error GoTo FAIL Set wb = ThisWorkbook wb.Activate ' do something useful DONE: On Error GoTo 0 Set wb = Nothing Exit Sub FAIL: MsgBox Err.Description GoTo DONE End Sub 

我有一些客户有这个问题,我最终在安装BlueBeam Extreme后开始得到它。 我取消选中了COM加载项中的BluebeamOfficeAddIn,并在closures我的.xlsm文件时popup了密码框。 我要做更多的挖掘,看看它是否是我的代码,但直到现在我还没有这个问题,禁用该插件似乎有帮助…