View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Patrick C. Simonds Patrick C. Simonds is offline
external usenet poster
 
Posts: 343
Default TextBox exit problem

This is the TextBox Exit code and it woks as long as the user clicks on
anything on the current MultiPage control. But if they click on the tab to
show the other page (of the MultiPage control) the TextBox Exit code does
not run.



Private Sub TextBox2203_Exit(ByVal Cancel As MSForms.ReturnBoolean)


Application.SpellingOptions.IgnoreCaps = False
Sheets("Sheet2").Unprotect

Sheets("Sheet2").Range("a1").Value = TextBox2203.Text
Application.EnableEvents = False
Sheets("Sheet2").Range("a1").CheckSpelling
Application.EnableEvents = True
TextBox2203.Text = ""
TextBox2203.Text = Sheets("Sheet2").Range("a1").Value
Sheets("Sheet2").Range("a1").Value = ""

If TextBox2203.Value < rng1(1, 7) Then

OptionButton2201.Value = False
OptionButton2202.Value = False
OptionButton2203.Value = False
OptionButton2204.Value = False
OptionButton2205.Value = False
OptionButton2206.Value = False

End If

End Sub






"Rick Rothstein" wrote in message
...
Without being able to see your code (to know what that code is actually
doing), it is a little difficult to give you a specific response; however,
the general way to do what you seem to be asking for is to put the code
you want run from the two event procedures in a subroutine and then call
the subroutine from both of those locations (rather than trying to get one
event procedure to trigger a different event). If there are procedure
specific code that must be run in conjunction with a core body of code,
that would usually be handled by providing an argument so the calling code
can tell the subroutine's code who called it.

--
Rick (MVP - Excel)


"Patrick C. Simonds" wrote in message
...
I thought of that as well and tried the code below thinking it would
trigger the Textbox exit routine.

Private Sub MultiPage1_Change()
TextBox201.SelectionMargin = True
End Sub

"Joel" wrote in message
...
You need a change event

Private Sub MultiPage1_Change()

End Sub

"Patrick C. Simonds" wrote:

On my UserForm I use a Multipage control. My problem is that I have
TextBox2201 on the second page, and it has a routine I want to run upon
exit
of the TextBox. All works well if the user clicks on something else on
page
2, but if the click on the tab to go back to page 1 the TextBox exit
routine does not run.