Private Sub Form_Current()
' MAX AMOUNT OF CHARACTERS UNTIL THE TEXTBOX WILL WORD WRAP
Const INCREASE_LINE_HEIGHT = 50
' ORIGINAL HEIGHT OF THE TEXTBOX
Const ORIGINAL_HEIGHT = 0.2035
' USED TO CONVER INCHES TO TWIPS
Const TWIPS = 1440
' USED TO DETERMINE THE SIZE OF THE TEXT BOX HEIGHT
Dim line_count As Integer
' holds text box text
Dim txtData As String
' holds textbox character length
Dim txtLength As String
' holds the number of times the text size should increase
Dim boxlines As Integer
' assign text box text
txtData = Nz(Me.WWG_Additional_Description, "")
' assign textbox length
txtLength = Len(txtData)
' if the amount of characters is created than increase the line height, then the text box size needs to be increased
' else the textbox goes back to its original state
If txtLength > INCREASE_LINE_HEIGHT Then
' get the amount of new lines required rounded up by 1
boxlines = Int(txtLength / INCREASE_LINE_HEIGHT) + 1
' resized the textbox by the multiplying the original height * the number of new lines * twips
Me.WWG_Additional_Description.Height = ORIGINAL_HEIGHT * boxlines * TWIPS
Else
' default to original state
boxlines = 1
Me.WWG_Additional_Description.Height = ORIGINAL_HEIGHT * TWIPS
End If
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE