R
RB Smissaert
How do I clear the format (font colour only) from a RichTextBox?
When I clear the text (TextRTF) and then put new text in in a different Sub
it works fine, but when I try to do the same in one Sub it doesn't work and
just keep the old format:
Private Sub CommandButton1_Click()
RichTextBox1.TextRTF = "SELECT E.TERM_TEXT FROM ENTRY E WHERE
E.READ_CODE = 'G58..'"
End Sub
Private Sub CommandButton2_Click()
RichTextBox1.TextRTF = vbNullString
End Sub
Private Sub CommandButton3_Click()
Dim strTemp As String
With RichTextBox1
strTemp = .Text
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
.SelColor = 0
.Text = vbNullString
.TextRTF = vbNullString
.TextRTF = strTemp
.Refresh
End With
End Sub
Number 3 doesn't work (although strTemp is a normal string with no
formatting) but number 1 after number 2
works fine.
RBS
When I clear the text (TextRTF) and then put new text in in a different Sub
it works fine, but when I try to do the same in one Sub it doesn't work and
just keep the old format:
Private Sub CommandButton1_Click()
RichTextBox1.TextRTF = "SELECT E.TERM_TEXT FROM ENTRY E WHERE
E.READ_CODE = 'G58..'"
End Sub
Private Sub CommandButton2_Click()
RichTextBox1.TextRTF = vbNullString
End Sub
Private Sub CommandButton3_Click()
Dim strTemp As String
With RichTextBox1
strTemp = .Text
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
.SelColor = 0
.Text = vbNullString
.TextRTF = vbNullString
.TextRTF = strTemp
.Refresh
End With
End Sub
Number 3 doesn't work (although strTemp is a normal string with no
formatting) but number 1 after number 2
works fine.
RBS