Mike De Salvo
Board Regular
- Joined
- Jul 11, 2012
- Messages
- 80
I have an interesting reoccuring problem that I can't seem to find answers to. I've developed a UserForm with the following code:
I did not include the individual Command Button codes above as I think they are not relevant to my problem. I have no problems with the UserForm codes or any of the macros in the Workbook. Everything works great until I close the application. UPON CLOSING I GET A PASSWORD PROMPT for Microsoft Visual Basic for Applications. This prompt goes away after I close it 3x pushing the left corner X button, but I would like to eliminate the problem entirely.
This password prompting ONLY OCCURS when I close Excel AFTER SAVING the Workbook. If I choose not to save the document, no password prompting occurs. If I keep Excel opened after closing the Workbook, the password prompt will delay until I close Excel even if it has been several hours past the closing of that workbook. Furthermore, the password prompting only occurs when I use the UserForm macro during that session. If the UserForm macro is not used in that session, it does not occur.
Does anyone have any ideas that might help me isolate the problem and fix it? This problem seems to be fairly common from my search on the web, but no answers. I hope the detail I've provided might bring an Excel-wiz closer to a resolution. Thanks in advance.
Code:
Option Explicit
Dim col_Selection As New Collection
Private Sub UserForm_Initialize()
Dim Ctl As MSForms.CheckBox
Dim chb_ctl As clsFormEvents
' Go thru the members of the frame and add them to the collection
For Each Ctl In f_Approaches.Controls
Set chb_ctl = New clsFormEvents
Set chb_ctl.chb = Ctl
col_Selection.Add chb_ctl
Next Ctl
End Sub
Private Sub CloseButton_Click()
frm_Setup.Hide
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
MsgBox "Please use the Close or Begin Valuation buttons to close form", vbCritical
Cancel = True
End If
End Sub
I did not include the individual Command Button codes above as I think they are not relevant to my problem. I have no problems with the UserForm codes or any of the macros in the Workbook. Everything works great until I close the application. UPON CLOSING I GET A PASSWORD PROMPT for Microsoft Visual Basic for Applications. This prompt goes away after I close it 3x pushing the left corner X button, but I would like to eliminate the problem entirely.
This password prompting ONLY OCCURS when I close Excel AFTER SAVING the Workbook. If I choose not to save the document, no password prompting occurs. If I keep Excel opened after closing the Workbook, the password prompt will delay until I close Excel even if it has been several hours past the closing of that workbook. Furthermore, the password prompting only occurs when I use the UserForm macro during that session. If the UserForm macro is not used in that session, it does not occur.
Does anyone have any ideas that might help me isolate the problem and fix it? This problem seems to be fairly common from my search on the web, but no answers. I hope the detail I've provided might bring an Excel-wiz closer to a resolution. Thanks in advance.