关闭excel时出现VBA密码提示

时间:2021-11-21 23:54:09

I have a sheet with a Workbook_Open code loading a userform. After closing the form and the workbook Excel prompts me for the VBA Project password.
I've found some info on this issue on this pages:
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

我有一张工作簿_Open代码加载用户窗体。关闭表单和工作簿后,Excel会提示我输入VBA项目密码。我在这个页面上找到了关于这个问题的一些信息:http://support.microsoft.com/kb/280454 http://social.msdn.microsoft.com/Forums/office/en-US/8cb79e54-26ae- 487C-8945-69b84b2e4eeb / COM-加载项和 - VBA的密码提示,错误

But it seems to be a problems with COM add-ins, which I have some. The problem is that the add-ins are not mine and I can't change or disable them.

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

Is there any other solution?

还有其他解决方案吗?

4 个解决方案

#1


2  

For me, the problem was not some add-ins or unreleased references. It was the Dropbox Badge. As soon as I removed it, the password was not solicited anymore when I closed Excel. To disable Dropbox Badge, open the Dropbox app, go to Settings, then Preferences and in the General Tab select "Never show" under Dropbox Badge. I found this solution on the following forum: https://www.excelforum.com/excel-programming-vba-macros/1100960-ever-annoying-vba-password-prompt-at-close-of-excel-2.html

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

#2


0  

I have a number of workbooks that were experiencing the same problem with some users. We went through the process of checking for COM add-ins and various combinations of Windows and Office.

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

In the end we included the following code as part of the workbook_beforeclose event and the problem was resolved for our users.

最后,我们将以下代码作为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

#3


0  

This happens when you have hanging pointers to objects. For every 'Set xyz=' you do in VBA, make sure that you have a corresponding 'Set xyz=Nothing'. Similarly for anything pointing to or obtained from COM objects. Make sure you close any ADO connections etc. Be especially careful to handle all errors so that ALL object variables are set to Nothing before the workbook can close, something along these lines:

当您挂起指向对象的指针时会发生这种情况。对于你在VBA中执行的每个'Set xyz =',确保你有一个相应的'Set xyz = Nothing'。类似地指向或从COM对象获取的任何内容。确保关闭所有ADO连接等。特别注意处理所有错误,以便在工作簿可以关闭之前将所有对象变量设置为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

#4


0  

I've had some clients have this issue and I finally started getting it after installing BlueBeam Extreme. I unchecked the BluebeamOfficeAddIn in the COM Add-Ins and the password box stopped popping up when closing my .xlsm file. I'm going to do more digging to see if it's my code but I haven't had this issue until now and disabling that addin seemed to help...

我有一些客户遇到这个问题,我终于在安装BlueBeam Extreme后开始使用它了。我取消选中COM加载项中的BluebeamOfficeAddIn,并在关闭我的.xlsm文件时停止弹出密码框。我要做更多的挖掘工作,看看它是否是我的代码,但直到现在我还没有解决这个问题,并且禁用addin似乎有帮助...

#1


2  

For me, the problem was not some add-ins or unreleased references. It was the Dropbox Badge. As soon as I removed it, the password was not solicited anymore when I closed Excel. To disable Dropbox Badge, open the Dropbox app, go to Settings, then Preferences and in the General Tab select "Never show" under Dropbox Badge. I found this solution on the following forum: https://www.excelforum.com/excel-programming-vba-macros/1100960-ever-annoying-vba-password-prompt-at-close-of-excel-2.html

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

#2


0  

I have a number of workbooks that were experiencing the same problem with some users. We went through the process of checking for COM add-ins and various combinations of Windows and Office.

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

In the end we included the following code as part of the workbook_beforeclose event and the problem was resolved for our users.

最后,我们将以下代码作为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

#3


0  

This happens when you have hanging pointers to objects. For every 'Set xyz=' you do in VBA, make sure that you have a corresponding 'Set xyz=Nothing'. Similarly for anything pointing to or obtained from COM objects. Make sure you close any ADO connections etc. Be especially careful to handle all errors so that ALL object variables are set to Nothing before the workbook can close, something along these lines:

当您挂起指向对象的指针时会发生这种情况。对于你在VBA中执行的每个'Set xyz =',确保你有一个相应的'Set xyz = Nothing'。类似地指向或从COM对象获取的任何内容。确保关闭所有ADO连接等。特别注意处理所有错误,以便在工作簿可以关闭之前将所有对象变量设置为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

#4


0  

I've had some clients have this issue and I finally started getting it after installing BlueBeam Extreme. I unchecked the BluebeamOfficeAddIn in the COM Add-Ins and the password box stopped popping up when closing my .xlsm file. I'm going to do more digging to see if it's my code but I haven't had this issue until now and disabling that addin seemed to help...

我有一些客户遇到这个问题,我终于在安装BlueBeam Extreme后开始使用它了。我取消选中COM加载项中的BluebeamOfficeAddIn,并在关闭我的.xlsm文件时停止弹出密码框。我要做更多的挖掘工作,看看它是否是我的代码,但直到现在我还没有解决这个问题,并且禁用addin似乎有帮助...