by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 24th February 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Make color tags in a rchtext box
Dim txt As String
Dim tag_open As Integer
Dim tag_close As Integer
txt = rch.Text
tag_close = 1
Do
' See where the next tag starts.
tag_open = InStr(tag_close, txt, "<")
If tag_open = 0 Then Exit Do
' See where the tag ends.
tag_close = InStr(tag_open, txt, ">")
If tag_open = 0 Then tag_close = Len(txt)
' Color the tag.
rch.SelStart = tag_open - 1
rch.SelLength = tag_close - tag_open + 1
rch.SelColor = vbRed
Loop
End Sub