ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   textbox insertion point. (https://www.excelbanter.com/excel-programming/424499-textbox-insertion-point.html)

bert

textbox insertion point.
 
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.


Tom Hutchins

textbox insertion point.
 
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

"Bert" wrote:

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.




All times are GMT +1. The time now is 11:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com