Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SMS SMS is offline
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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   Report Post  
Posted to microsoft.public.excel.programming
SMS SMS is offline
external usenet poster
 
Posts: 15
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling other events from an initial event Ferret via OfficeKB.com Excel Programming 2 December 16th 08 10:21 PM
Event Handlers: Getting a handle to the calling object AllSensibleNamesTaken Excel Programming 8 November 18th 08 03:41 AM
Calling a button event from a .NEt application Stanley Excel Programming 0 June 9th 06 01:25 PM
Event procedures: who is calling? Momo[_2_] Excel Programming 2 April 22nd 06 08:12 AM
Calling same event for all the toolbox controls in the sheet neetha Excel Programming 0 March 8th 06 05:01 AM


All times are GMT +1. The time now is 04:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"