How to select the contents of a textbox once it is activated?

前端 未结 10 2239
灰色年华
灰色年华 2020-12-06 05:16

I have this simple Userform, where I only have TextBox1 and TextBox2. I enter some text in both of them. Assume the focus is on (the cursor is in)

10条回答
  •  时光说笑
    2020-12-06 06:05

    The behavior you're trying to implement is already built in to the TextBox. When you move the mouse over the left side of the text box, the mouse pointer will point to the right. If you click, it will select all the text in the field. Clicking anywhere else will deselect the text.

    I will try a few other strategies to see if I can get this to work in one Sub.

提交回复
热议问题