TextBox exit problem

  • Thread starter Patrick C. Simonds
  • Start date
P

Patrick C. Simonds

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.
 
P

Patrick C. Simonds

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
 
R

Rick Rothstein

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.
 
P

Patrick C. Simonds

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top