Sub ColorIt(ByVal lBegPos As Long, ByVal lLength As Long)
RichTextBox1.SelStart = lBegPos - 1
RichTextBox1.SelLength = lLength
RichTextBox1.SelColor = vbRed
End Sub
Private Sub RichTextBox1_Change()
Dim sst As Long, slln As Long
Dim lCurPos As Long
RichTextBox1.Enabled = False
sst = RichTextBox1.SelStart
slln = RichTextBox1.SelLength
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text) + 1
RichTextBox1.SelColor = vbBlack
lCurPos = 0
Do
lCurPos = InStr(lCurPos + 1, RichTextBox1.Text, "<HTML> ", vbTextCompare)
If lCurPos = 0 Then Exit Do
ColorIt lCurPos, 4 'Количество символов, которые будут окрашиваться
Loop
RichTextBox1.SelStart = sst
RichTextBox1.SelLength = slln
RichTextBox1.SelColor = vbBlack
RichTextBox1.Enabled = True
RichTextBox1.SetFocus
End Sub
Сейчас этот форум просматривают: AhrefsBot, PetalBot и гости: 9