Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get An Event To Run When I Exit A TextBox

Greetings,

I need to have a format command to wait until I have finished typing
in a TextBox and when I exit the TextBox for the format to run then.
I have checked the help files for what events are available and could
not find one that would work.

Any one have any suggestions?

TIA

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How To Get An Event To Run When I Exit A TextBox

If the textbox is in a userform, then use the Exit event.

In a worksheet, you would have to use one of the key events like KeyDown to
test for keys such as return or tab and perform you action then. Here is
some code Rob Bovey posted which is used to tab between textboxes on a
worksheet, but you can modify it to fit your needs. It too is looking for
the user to finish typing:

Private Sub TextBoxCurrent_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim bBackwards As Boolean
Select Case KeyCode
''' These are the only keys we care about.
Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp
Application.ScreenUpdating = False
''' Determine if we need to move backwards.
bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp)
''' In Excel 97 we must select a cell
''' before activating another control.
If Application.Version < 9 Then Sheet1.Range("A1").Select
''' Activate the appropriate control based on key(s) pressed.
If bBackwards Then TextBoxPrevious.Activate Else _
TextBoxNext.Activate
Application.ScreenUpdating = True
End Select
End Sub

--
Regards,
Tom Ogilvy

"Minitman" wrote in message
...
Greetings,

I need to have a format command to wait until I have finished typing
in a TextBox and when I exit the TextBox for the format to run then.
I have checked the help files for what events are available and could
not find one that would work.

Any one have any suggestions?

TIA

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get An Event To Run When I Exit A TextBox

Hey Tom,

I appreciate this reply and all of the assistance you give so freely.

This solution is interesting but it goes a lot farther then I need.

Check out the other reply, it seems to be a bit more simplified.

-Minitman


On Fri, 22 Oct 2004 13:07:50 -0400, "Tom Ogilvy"
wrote:

If the textbox is in a userform, then use the Exit event.

In a worksheet, you would have to use one of the key events like KeyDown to
test for keys such as return or tab and perform you action then. Here is
some code Rob Bovey posted which is used to tab between textboxes on a
worksheet, but you can modify it to fit your needs. It too is looking for
the user to finish typing:

Private Sub TextBoxCurrent_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim bBackwards As Boolean
Select Case KeyCode
''' These are the only keys we care about.
Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp
Application.ScreenUpdating = False
''' Determine if we need to move backwards.
bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp)
''' In Excel 97 we must select a cell
''' before activating another control.
If Application.Version < 9 Then Sheet1.Range("A1").Select
''' Activate the appropriate control based on key(s) pressed.
If bBackwards Then TextBoxPrevious.Activate Else _
TextBoxNext.Activate
Application.ScreenUpdating = True
End Select
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How To Get An Event To Run When I Exit A TextBox

If the textbox is in a userform, then use the Exit event.

Read my suggestion. The first suggestion I made was the exit event (which
only works for a userform). This is the same suggestion posted after me by
Mr. Datasort. without such qualification or explanation and which you found
so helpful. I then offered an alternative approach again, stating clearly
that this was if your textbox was not on a userform.

Check out the other reply, it seems to be a bit more simplified.

Kick me again <LOL

--
Regards,
Tom Ogilvy

"Minitman" wrote in message
...
Hey Tom,

I appreciate this reply and all of the assistance you give so freely.

This solution is interesting but it goes a lot farther then I need.

Check out the other reply, it seems to be a bit more simplified.

-Minitman


On Fri, 22 Oct 2004 13:07:50 -0400, "Tom Ogilvy"
wrote:

If the textbox is in a userform, then use the Exit event.

In a worksheet, you would have to use one of the key events like KeyDown

to
test for keys such as return or tab and perform you action then. Here is
some code Rob Bovey posted which is used to tab between textboxes on a
worksheet, but you can modify it to fit your needs. It too is looking

for
the user to finish typing:

Private Sub TextBoxCurrent_KeyDown(ByVal KeyCode As

MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim bBackwards As Boolean
Select Case KeyCode
''' These are the only keys we care about.
Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp
Application.ScreenUpdating = False
''' Determine if we need to move backwards.
bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp)
''' In Excel 97 we must select a cell
''' before activating another control.
If Application.Version < 9 Then Sheet1.Range("A1").Select
''' Activate the appropriate control based on key(s) pressed.
If bBackwards Then TextBoxPrevious.Activate Else _
TextBoxNext.Activate
Application.ScreenUpdating = True
End Select
End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get An Event To Run When I Exit A TextBox

Hey Tom.

I must apologize. I did not understand that "Exit" was the name of
the Exit event until I saw the code snippet. My only excuse is my
inexperience with VBA and writing code.

I did not mean to "Kick" you once or again.

Please accept my apology.

I find the knowledge and assistance you dispense so unselfishly to be
of great value. Please, don't let my ignorant babblings discourage
you in the pursuit of educating the unexperienced and uneducated
wannabe Excel programmers out here to comprehend the deepest mysteries
of Excel. <G

-Minitman



On Fri, 22 Oct 2004 15:16:24 -0400, "Tom Ogilvy"
wrote:

If the textbox is in a userform, then use the Exit event.


Read my suggestion. The first suggestion I made was the exit event (which
only works for a userform). This is the same suggestion posted after me by
Mr. Datasort. without such qualification or explanation and which you found
so helpful. I then offered an alternative approach again, stating clearly
that this was if your textbox was not on a userform.

Check out the other reply, it seems to be a bit more simplified.

Kick me again <LOL




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How To Get An Event To Run When I Exit A TextBox

I did say
Kick me again <LOL

I guess I should have used "<g" to be clearer - it was an attempt at grim
humor. No need to apologize. The original poster is always free to make
their own decisions. (and I am free to be Sardonic <g)

--
Regards,
Tom Ogilvy

"Minitman" wrote in message
...
Hey Tom.

I must apologize. I did not understand that "Exit" was the name of
the Exit event until I saw the code snippet. My only excuse is my
inexperience with VBA and writing code.

I did not mean to "Kick" you once or again.

Please accept my apology.

I find the knowledge and assistance you dispense so unselfishly to be
of great value. Please, don't let my ignorant babblings discourage
you in the pursuit of educating the unexperienced and uneducated
wannabe Excel programmers out here to comprehend the deepest mysteries
of Excel. <G

-Minitman



On Fri, 22 Oct 2004 15:16:24 -0400, "Tom Ogilvy"
wrote:

If the textbox is in a userform, then use the Exit event.


Read my suggestion. The first suggestion I made was the exit event (which
only works for a userform). This is the same suggestion posted after me

by
Mr. Datasort. without such qualification or explanation and which you

found
so helpful. I then offered an alternative approach again, stating

clearly
that this was if your textbox was not on a userform.

Check out the other reply, it seems to be a bit more simplified.

Kick me again <LOL




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How To Get An Event To Run When I Exit A TextBox

Try the event

Private Sub TBox_NAME_Exit(ByVal Cancel As MSForms.ReturnBoolean)

where TBox_NAME is the name of your text box

"Minitman" wrote:

Greetings,

I need to have a format command to wait until I have finished typing
in a TextBox and when I exit the TextBox for the format to run then.
I have checked the help files for what events are available and could
not find one that would work.

Any one have any suggestions?

TIA

-Minitman

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Get An Event To Run When I Exit A TextBox

Thank you

That is just what I was hoping for.

-Minitman

On Fri, 22 Oct 2004 10:09:06 -0700, "Datasort"
wrote:

Try the event

Private Sub TBox_NAME_Exit(ByVal Cancel As MSForms.ReturnBoolean)

where TBox_NAME is the name of your text box

"Minitman" wrote:

Greetings,

I need to have a format command to wait until I have finished typing
in a TextBox and when I exit the TextBox for the format to run then.
I have checked the help files for what events are available and could
not find one that would work.

Any one have any suggestions?

TIA

-Minitman


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
Private Textbox Exit Sub question... [email protected] Excel Worksheet Functions 14 March 1st 07 03:58 AM
combobox exit event Dave D[_3_] Excel Programming 0 April 28th 04 10:22 PM
Exit Event Michael J. Malinsky Excel Programming 1 February 27th 04 06:40 PM
MSForms.TextBox Exit event isn't available in Excel class mosule lacos Excel Programming 2 December 12th 03 10:12 AM
Control Exit event Fred Excel Programming 0 November 19th 03 12:59 AM


All times are GMT +1. The time now is 06:03 PM.

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

About Us

"It's about Microsoft Excel"