View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 292
Default Textbox in userform

Hi

I'm not sure if it's a bug or a deliberate design choice, but when you
exitting a container you're not really exitting its control (s). So try
trapping the Exit event of the frame also.

HTH. Best wishes Harald

"Pierre Scerri" skrev i melding
...
I am having a problem with Textboxes in a UserForm.

My form contains four frames, each with some textboxes and labels. There
are also some Command Buttons outside the frames.

One of the frames (third in tab order) contains four identical textboxes
into which I input a 4 digit number which represents a time. All these

boxes
have autotab switched on and maxlength set to 4, so that as I type each
4-digit number the cursor moves to the next box.

Each of these boxes are associated with 2 subroutines, TextBox_Change()

and
TextBox_Exit() as I need to perform actions while editing and when I go to
the next box. The routines for each box are the identical.

Now here comes the crunch:

As I enter numbers everything works perfectly for the first 3 boxes. As I
type the 4th digit into the last box, the cursor jumps straight to the

next
box in the next frame without going through the TextBox_Exit() macro.

It gets even weirder. If I now click anywhere on my 4-box frame, the
TextBox_Exit() macro for the 4th box is executed.