View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default CRLF in text box

Yes Neil, MultiLine and EnterKeyBehvior were both as you specified (true).
I put in several enter keys at the end of the a and it worked fine, removing
them all.

I put on two commandbuttons to peform the removal and document what was in
textbox1:

Private Sub CommandButton1_Click()
For i = 1 To Len(TextBox1.Text)
Debug.Print i, Asc(Mid(TextBox1.Text, i, 1))
Next
End Sub

Private Sub CommandButton2_Click()
With UserForm1
Do While Right(.TextBox1.Text, 2) = vbCrLf
.TextBox1.Text = LeftB(.TextBox1.Text, Len(.TextBox1.Text) - 2)
Loop
End With

End Sub




--
Regards.
Tom Ogilvy


Neil Miller wrote in message
...

Thanks for your prompt response, but it's still not working for me. I
tried the following workaround:

Dim mY_stR As String
With UserForm1
If Trim(.TextBox1.Text) < "" Then
mY_stR = Trim(.TextBox1.Text)
.TextBox1.Text = ""
Do While Right(mY_stR, 2) = vbCrLf
mY_stR = Left(mY_stR, Len(mY_stR) - 2)
Loop
.TextBox1.Text = "" = mY_stR
End If
End With

When the contents of mY_stR are stored back into the textbox, then the
VBA watch for that field, and the textbox on the displayed form, both
show "False".

In the test you tried, is MultiLine set to True? I can get round the
problem if this is set to False, but that really defeats the object.

Many thanks.......Neil


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!