Hi! I have several controls on my VB form that have code attached to their Exit event. Apparently, if one of these controls has the focus when the user closes the form, it triggers the Exit event for that control, which runs the code and causes errors because it is referring to objects which are no longer loaded!!
Is there a way to avoid triggering the Exit event in that case? I played around with UserForm_QueryClose but couldn't come up with a satisfactory solution. Creating my own "Close Form" button results in the same problem, because the Exit event code still runs for the control with the focus. And yes, the code needs to be attached to the Exit event!
Thanks for your help!
VBAjedi
Is there a way to avoid triggering the Exit event in that case? I played around with UserForm_QueryClose but couldn't come up with a satisfactory solution. Creating my own "Close Form" button results in the same problem, because the Exit event code still runs for the control with the focus. And yes, the code needs to be attached to the Exit event!
Thanks for your help!
VBAjedi