textbox insertion point.

B

Bert

In Userform1.TextBox1 I enter text normally. I can also insert pre-defined
strings by clicking on a combobox in the same Userform.
After the code runs to insert the predefined strings, the cursor does not
show in the textbox. I can obviously click in the box to make it appear;
however, it would be nice to have the insertion point visible when the code
to insert the string is finished running. I've tried SetFocus and SelStart,
but they don't do it.
 
T

Tom Hutchins

I have had the same problem for a long time, and your post prompted me to
finally do something about it. It looks like the problem is that the userform
has lost the focus. I just got mine to work as intended by adding an
AppActivate command before the TextBox.SetFocus command. For example:

'Put the contents of the selected cell in the Pinyin form textbox.
frmPinyin.txtInput.Text = ActiveCell.FormulaR1C1
AppActivate "Pinyin Input", True
frmPinyin.txtInput.SetFocus

In this example "Pinyin Input" is the title of my userform, and txtInput is
the name of the textbox.

Hope this helps,

Hutch
 

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