Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm TextBox with fixed Width and dynamic Height
Hello,
Can we have a multi line TextBox in a Userform with fixed width but the height adjusting according to the length of text? Say if the textbox contains text to be fit in five lines then adjust the height accrdingly? also with a maximum height fixed, so that it may not be more than the height of the userfom itself. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm TextBox with fixed Width and dynamic Height
Hi Soniya,
like this: Private Sub TextBox1_Change() TextBox1.Width = 100 ' to restrict autosize to vertical If TextBox1.Height 75 Then TextBox1.Height = 75 TextBox1.AutoSize = False End If End Sub plus multiline = true autosize = true wordwrap = true Unfortunately, when typing some lines of text, the first line vanishes temporarily, but reappears when the textbox looses focus. -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Just fooling around with Excel a bit Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de" |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm TextBox with fixed Width and dynamic Height
You could play around a bit with it, by adjusting the height by the number
of characters, but I doubt that you can be totally accurate as it depends upon where the word breaks. Private Sub TextBox1_Change() With Me.TextBox1 .Height = Application.Min(Me.Height - 32, (Int(Len(.Text) / Int(.Width / 4.7)) + 1) * 18) End With End Sub should get you started on the idea, but you will need to play with the variables to suit. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Soniya" wrote in message oups.com... Hello, Can we have a multi line TextBox in a Userform with fixed width but the height adjusting according to the length of text? Say if the textbox contains text to be fit in five lines then adjust the height accrdingly? also with a maximum height fixed, so that it may not be more than the height of the userfom itself. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Rows & Columns Fixed Width / Height | Excel Discussion (Misc queries) | |||
Fixed width fonts | Excel Discussion (Misc queries) | |||
Cells Fixed height and width | Excel Discussion (Misc queries) | |||
Dynamic update of UserForm TextBox | Excel Programming | |||
Fixed Width - Opening Certain Fixed Width Files | Excel Programming |