Desable "Cancel" event
Public bBlockEvents as Boolean
Private Sub Textbox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
if bBlockEvents then exit sub
End sub
Sub CmdExit_Click()
bBlockEvents = True
end Sub
so use a public variable in the userform module to indicate your intention
and exercise control.
--
Regards,
Tom Ogilvy
"LuisE" wrote:
Ive been trying to write a routine to prevent empty textboxes. Im using the
TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) event. But since I
disabled the close button and using a CommandButton instead; if the user
doesnt make any entry at all, itll still trigger the error message when
closing the form. Is there a way around it. Can I cancel the €ścancel event€ť
while closing the form from the CommandButton?
I cant retain the focus on the control. I also tried the BeforeUpdate event
but didnt get the expected results. Do you know of any good source of
related documentation?
|