Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling an _Exit event
Hi All... The _Exit event for a textbox say, is called when leaving the textbox (anything to cause a loss of focus, it seems). I am used to being able to call events from code directly (ex: _change events). This is proving harder for the _Exit event, as it requires a special cancel argument. Using 0 or 1 or False or True does not work, as it is not a normal boolean. Could someone demonstrate for me how to call the _Exit event of a textbox? Thank you! SMS |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling an _Exit event
Don't know if this helps but this is from the VBA Help file:
The Enter and Exit events are similar to the GotFocus and LostFocus events in Visual Basic. Unlike GotFocus and LostFocus, the Enter and Exit events don't occur when a form receives or loses the focus. For example, suppose you select the check box that initiates the Enter event. If you then select another control in the same form, the Exit event is initiated for the check box (because focus is moving to a different object in the same form) and then the Enter event occurs for the second control on the form. Because the Enter event occurs before the focus moves to a particular control, you can use an Enter event procedure to display instructions; for example, you could use a macro or event procedure to display a small form or message box identifying the type of data the control typically contains. Note To prevent the control from losing focus, assign True to the Cancel argument of the Exit event. "SMS" wrote in message ... Hi All... The _Exit event for a textbox say, is called when leaving the textbox (anything to cause a loss of focus, it seems). I am used to being able to call events from code directly (ex: _change events). This is proving harder for the _Exit event, as it requires a special cancel argument. Using 0 or 1 or False or True does not work, as it is not a normal boolean. Could someone demonstrate for me how to call the _Exit event of a textbox? Thank you! SMS |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling an _Exit event
I re-read your post and I think this is what you are looking for:
If the TextBox is on a sheet and you call from within the sheet code module or if it is on a UserForm and you call from the form code module: Private Sub TextBox1_Exit() 'Code here End Sub Calling a Private Sub from outside its host (Sheet or UserForm) can be a little tricky. For the UserForm, the form would have to be visible and modeless. I have never tried to initiate an event code without actually having the event occur and my dim wit cannot visualize how that would even be necessary. "JLGWhiz" wrote in message ... Don't know if this helps but this is from the VBA Help file: The Enter and Exit events are similar to the GotFocus and LostFocus events in Visual Basic. Unlike GotFocus and LostFocus, the Enter and Exit events don't occur when a form receives or loses the focus. For example, suppose you select the check box that initiates the Enter event. If you then select another control in the same form, the Exit event is initiated for the check box (because focus is moving to a different object in the same form) and then the Enter event occurs for the second control on the form. Because the Enter event occurs before the focus moves to a particular control, you can use an Enter event procedure to display instructions; for example, you could use a macro or event procedure to display a small form or message box identifying the type of data the control typically contains. Note To prevent the control from losing focus, assign True to the Cancel argument of the Exit event. "SMS" wrote in message ... Hi All... The _Exit event for a textbox say, is called when leaving the textbox (anything to cause a loss of focus, it seems). I am used to being able to call events from code directly (ex: _change events). This is proving harder for the _Exit event, as it requires a special cancel argument. Using 0 or 1 or False or True does not work, as it is not a normal boolean. Could someone demonstrate for me how to call the _Exit event of a textbox? Thank you! SMS |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling an _Exit event
Hi, thanks very much for trying... actually, and I know it can make a difference, this is a control on a userform. I know how to write the _Exit event, what I need is a way to call the event from code. It already triggers when the actual event happens.... but I do like to be able to force the event. Does that make sense? SMS On Oct 7, 3:15*pm, "JLGWhiz" wrote: I re-read your post and I think this is what you are looking for: If the TextBox is on a sheet and you call from within the sheet code module or if it is on a UserForm and you call from the form code module: Private Sub TextBox1_Exit() * *'Code here End Sub Calling a Private Sub from outside its host (Sheet or UserForm) can be a little tricky. *For the UserForm, the form would have to be visible and modeless. *I have never tried to initiate an event code without actually having the event occur and my dim wit cannot visualize how that would even be necessary. "JLGWhiz" wrote in message ... Don't know if this helps but this is from the VBA Help file: The Enter and Exit events are similar to the GotFocus and LostFocus events in Visual Basic. Unlike GotFocus and LostFocus, the Enter and Exit events don't occur when a form receives or loses the focus. For example, suppose you select the check box that initiates the Enter event. If you then select another control in the same form, the Exit event is initiated for the check box (because focus is moving to a different object in the same form) and then the Enter event occurs for the second control on the form. Because the Enter event occurs before the focus moves to a particular control, you can use an Enter event procedure to display instructions; for example, you could use a macro or event procedure to display a small form or message box identifying the type of data the control typically contains. Note To prevent the control from losing focus, assign True to the Cancel argument of the Exit event. "SMS" wrote in message ... Hi All... The _Exit event for a textbox say, is called when leaving the textbox (anything to cause a loss of focus, it seems). I am used to being able to call events from code directly (ex: _change events). *This is proving harder for the _Exit event, as it requires a special cancel argument. *Using 0 or 1 or False or True does not work, as it is not a normal boolean. Could someone demonstrate for me how to call the _Exit event of a textbox? Thank you! SMS- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
calling other events from an initial event | Excel Programming | |||
Event Handlers: Getting a handle to the calling object | Excel Programming | |||
Calling a button event from a .NEt application | Excel Programming | |||
Event procedures: who is calling? | Excel Programming | |||
Calling same event for all the toolbox controls in the sheet | Excel Programming |