Option Explicit
Private bXit As Boolean
Private Sub UserForm_Activate()
[B][COLOR=#008000] 'Any pre-existing UserForm_Activate event code goes here[/COLOR][/B]
Call DoLoop
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
bXit = True
End Sub
Private Sub DoLoop()
Do
DoEvents
Loop Until bXit
End Sub
On Error Resume Next
CallByName Application, "EnableCancelKey", VbLet, 0
On Error GoTo 0
Code:On Error Resume Next CallByName Application, "EnableCancelKey", VbLet, 0 On Error GoTo 0