UserForm Entry event does not fire

P

Peter

I have a userform that has a text field. I want part of the text field
selected when the user enters the text field. I use fieldname_Enter() macro
and then use fieldname.selStart = 3 and fieldname.selLength = Len(fieldname)
- 3 to set the selection (third character to end). This seems to sometimes
work but most of the time the entire field is selected. If I place a
breakpoint on this first line of this macro and step through it, it works
every time.
I have another userform that has this implemented for two fields on the
form. It never works for one but always works for the other!

Anybody have any idea what is going on? Why does it work when the debugger
is run and not otherwise.

Thanks!
Peter
 
C

Cindy M.

Hi =?Utf-8?B?UGV0ZXI=?=,
I have a userform that has a text field. I want part of the text field
selected when the user enters the text field. I use fieldname_Enter() macro
and then use fieldname.selStart = 3 and fieldname.selLength = Len(fieldname)
- 3 to set the selection (third character to end). This seems to sometimes
work but most of the time the entire field is selected. If I place a
breakpoint on this first line of this macro and step through it, it works
every time.
I have another userform that has this implemented for two fields on the
form. It never works for one but always works for the other!
Try changing the EnterFieldBehavior property for the textbox control. By
default it's "select all".

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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