ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Aligning text in a box (https://www.excelbanter.com/excel-programming/377791-aligning-text-box.html)

Hank Youngerman

Aligning text in a box
 
I have a text box that contains instructions on running a program. The
length is larger than I want the userform and textbox to be, so it has
vertical scroll bars. However, when I open it, the text appears from
the bottom up. That is, if only 50% is visible at a time, it shows the
last 50%, and I would like it to show the first 50%.

My code is:

Private Sub ShowInstructions()
Load UserForm1
UserForm1.Textbox.Text = "These are the instructions. In reality they
are many paragraphs long."
UserForm1.show
End Sub


The textbox does have vertical scroll bars, and it is handling line
breaks just fine. It's just the initial positioning of the visible
text that is bad.


Bob Phillips

Aligning text in a box
 
Put this in the activate event

TextBox1.SelStart = 0


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Hank Youngerman" wrote in message
oups.com...
I have a text box that contains instructions on running a program. The
length is larger than I want the userform and textbox to be, so it has
vertical scroll bars. However, when I open it, the text appears from
the bottom up. That is, if only 50% is visible at a time, it shows the
last 50%, and I would like it to show the first 50%.

My code is:

Private Sub ShowInstructions()
Load UserForm1
UserForm1.Textbox.Text = "These are the instructions. In reality they
are many paragraphs long."
UserForm1.show
End Sub


The textbox does have vertical scroll bars, and it is handling line
breaks just fine. It's just the initial positioning of the visible
text that is bad.





All times are GMT +1. The time now is 05:33 AM.

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