Serge
Jan 1st, 2000, 04:58 AM
Check out the RichTextBox control. It can do what you want (concerning colors of your tags). You would have to use SelColor property to assign the desired color.
Public Sub ColorTag(pRich As RichTextBox, pstrTag As String, pColor As Long)
Dim iPos As Integer
iPos = 1
iPos = InStr(iPos, pRich.Text, pstrTag)
Do While iPos
pRich.SelStart = iPos
pRich.SelLength = Len(pstrTag)
pRich.SelColor = pColor
iPos = InStr(iPos + Len(pstrTag), pRich.Text, pstrTag)
Loop
End Sub
Usage: ColorTag RichTextBox, TagToColor, Color
Example: ColorTag RichText1, "<HTML>", vbBlue
You can also use an RGB function gor the color.
For your second question you can do something like this:
Text1.SelText = "MyText"
This will insert the text where the cursor is.
------------------
Serge
Software Developer
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
Public Sub ColorTag(pRich As RichTextBox, pstrTag As String, pColor As Long)
Dim iPos As Integer
iPos = 1
iPos = InStr(iPos, pRich.Text, pstrTag)
Do While iPos
pRich.SelStart = iPos
pRich.SelLength = Len(pstrTag)
pRich.SelColor = pColor
iPos = InStr(iPos + Len(pstrTag), pRich.Text, pstrTag)
Loop
End Sub
Usage: ColorTag RichTextBox, TagToColor, Color
Example: ColorTag RichText1, "<HTML>", vbBlue
You can also use an RGB function gor the color.
For your second question you can do something like this:
Text1.SelText = "MyText"
This will insert the text where the cursor is.
------------------
Serge
Software Developer
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)