View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SMS SMS is offline
external usenet poster
 
Posts: 15
Default Simple SetFocus on userform issue

Interesting Update!!!!

The problem seems to relate to the existance of a FRAME.

If there is a frame object (with tabstop set to true) on the same
userform... then it causes things to fail, even in the case of my
"workaround" solution.

This is some crazy interaction.... is there any rhyme or reason to it?


On Oct 1, 3:58*pm, SMS wrote:
OK, I have a "solution". *It's stupid, but it works.

I am able to set the focus from the textbox afterupdate event code to
any other text box, but EXCEPT the one executing the event.

the solution is to have TWO text boxes... in the same location. *Each
one has the same code... but sets the focus to the other one, and at
the same time toggling visiblilty of both textboxes. * *The effect is
that it looks like the same text box... but really, we are hopping
back and forth between them.

Sigh. *Excel usually rocks. *This, however, has been a real headache.
I hope this workaround helps others.

On Oct 1, 2:00*pm, SMS wrote:



Well, it SOUNDS simple...


Userform with three controls, TextBox1, TextBox2, TextBox3


For TextBox2 ONLY, I have this code:


* Private Sub TextBox2_afterupdate()
* * * counter = counter +1
* * * TextBox2.Text = ""
* * * TextBox2.SetFocus
* End Sub


This is supposed to increment a counter, clear the textbox... and here
is the ****er: SET THE FOCUS BACK TO TEXTBOX2.


This appears to be impossible... I have spent hours on it.


Please help!


Again, the sole goal here is to get the same text box to have focus
when the event is finished.


Thank you SO much...- Hide quoted text -


- Show quoted text -