P
Pablo
hello:
this ng is great! Without _really_ knowing any "coding" I have been
able to patch together the following from postings in this group:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
' Prevents use of the Close button
If CloseMode = vbFormControlMenu Then
Cancel = True
ErrorBox = MsgBox("Would you like to close this workbook?",
vbYesNo, "Error")
If ErrorBox = YbYes Then
ActiveWorkbook.Close
ElseIf ErrorBox = YbNo Then
Cancel = True
End If
End If
End Sub
However, when I hit the run button, the form pops up, and if I click
the X in the top right corner of the form, the message box pops up. So
far so good.
But if I click on [Yes] it's no different than clicking [No]. [No]
does what I want, but [Yes] doesn't close the book.
Thanks for your help!
this ng is great! Without _really_ knowing any "coding" I have been
able to patch together the following from postings in this group:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
' Prevents use of the Close button
If CloseMode = vbFormControlMenu Then
Cancel = True
ErrorBox = MsgBox("Would you like to close this workbook?",
vbYesNo, "Error")
If ErrorBox = YbYes Then
ActiveWorkbook.Close
ElseIf ErrorBox = YbNo Then
Cancel = True
End If
End If
End Sub
However, when I hit the run button, the form pops up, and if I click
the X in the top right corner of the form, the message box pops up. So
far so good.
But if I click on [Yes] it's no different than clicking [No]. [No]
does what I want, but [Yes] doesn't close the book.
Thanks for your help!