Text wraping on edit box of dialogsheet
the text content wrap rather than continuing on to the right past the
size of the box. Any ideas welcome please.
With DialogSheets("FormAdd")
.EditBoxes("Edit Box 144").Text = ""
.Show
End With
the text content wrap rather than continuing on to the right past the
size of the box. Any ideas welcome please.
With DialogSheets("FormAdd")
.EditBoxes("Edit Box 144").Text = ""
.Show
End With
Hi,
Check if the EditBox has a WordWrap property, if it does set it to true. If it doesn't then it might have something equivalent, like maybe a Wrap property, if it doesn't then it won't be possible unless you implement the wrapping logic yourself.
.EditBoxes("Edit Box 144").WordWrap = True
As Derek mentioned in his answer. Set WordWrap to true.
Also set MultiLine to True, but this will only work if the height of the textbox is sufficient to accomodate the lines of text.
In the example blow the textbox width was 72.
This should get you on your way.
Private Sub TextBox1_Change()
origHeight = 15
textlen = Int(Len(TextBox1.Text) / 15) + 1
TextBox1.Height = origHeight * textlen
End Sub
You'll have to play around with the figures but it will produce what you need.
ChasAA
The line of code doesn't work on its own either even in the absence of the .text line.
supplied) makes the text wrap as I want. The height of the box is more
than sufficient but it seems to limit content to what's probably 256
characters (didn't count them). Is there a simple way to extend this to
allow more
characters to be entered ? How would this be reflected on my original
code for loading the form as there are no property setitings covering
this ?
rabbitoh,
What software you developing in ?
DialogSheet and EditBoxes sound like older versions of forms and text boxes, this might explain the 256 character limit.
created a few version back, which still work just fine. Rather then
reinventing the wheel each time I just recycle and modify to suit but
occasionally, I run into a variation - such as this word-wrap or
Multiline issue (which now solves the wrapping problem), that presents
an obstacle.
T
worksheet tab and inserting a dialog sheet, I have inserted a userform
in the visual basic editor window. As I type, the code you provided
progressivly increases the size of the data field way in advance of my
typing. Running the form without the code and ensuring MultiLine is set
to true, enables the form to work as required though, however you did
lead me to the solution and that is appreciated. Thank you.