M
mark
Hello.
I have several textboxes that I'm going to need to limit the text in to a
specific number of rows... not all the same number of rows... dependent upon
which box it is.
I have the limiting code working reasonably well for a give box, but would
like to write that code into a subroutine that I pass the textbox object, and
the row limit.
I've tried several things, but so far, I either get a type mismatch on the
call, or a message that the object doesn't support that property (LineCount
property of the textbox) in the subroutine itself.
Here is the calling routine:
Private Sub txtGenResp_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
sbLimitText txtGenResp, 9
End Sub
and the routine called:
Sub sbLimitText(txtBox As OLEObject, intRowLimit As Integer)
If txtBox.LineCount > intRowLimit Then
While txtBox.LineCount > intRowLimit
txtBox.Text = Left(txtBox.Text, txtBox.TextLength - 2)
Wend
End If
That is passing the default property of the textbox object, it's text. I
need it to pass the object itself.
Could someone point me to the error of my ways?
Mark
I have several textboxes that I'm going to need to limit the text in to a
specific number of rows... not all the same number of rows... dependent upon
which box it is.
I have the limiting code working reasonably well for a give box, but would
like to write that code into a subroutine that I pass the textbox object, and
the row limit.
I've tried several things, but so far, I either get a type mismatch on the
call, or a message that the object doesn't support that property (LineCount
property of the textbox) in the subroutine itself.
Here is the calling routine:
Private Sub txtGenResp_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
sbLimitText txtGenResp, 9
End Sub
and the routine called:
Sub sbLimitText(txtBox As OLEObject, intRowLimit As Integer)
If txtBox.LineCount > intRowLimit Then
While txtBox.LineCount > intRowLimit
txtBox.Text = Left(txtBox.Text, txtBox.TextLength - 2)
Wend
End If
That is passing the default property of the textbox object, it's text. I
need it to pass the object itself.
Could someone point me to the error of my ways?
Mark