Makes a multi-line textbox into a scrolling textbox, chat-style.
Usage
post frmLogging.text1, "Text to Post"
Side Effects
Constant MAXCHARS must be declared at the top of the module. Do not exceed 50000 for MAXCHARS.
Const MAXCHARS = 5000
Public Sub Post(tbxEditBox As TextBox, sNewText As String)
sNewText = sNewText & vbCrLf
With tbxEditBox
If Len(sNewText) + Len(.Text) > MAXCHARS Then
''Scroll some text off the top to make more room
.Text = Mid$(.Text, InStr(100 + Len(sNewText), .Text, vbCrLf) + 2)
End If
.SelStart = Len(.Text)
.SelText = sNewText
End With
DoEvents
End Sub