
Rich Textbox and SelColor
Works here... even though I assumed you'd need to select at least one character, I gave it a try anyway and the color is tracked correctly.
'================
Option Explicit
Private Sub Form_Load()
With RichTextBox1
'Clear all
.Text = ""
.SelColor = vbRed
.SelText = "This is red text"
.SelBold = True
.SelColor = vbBlue
.SelText = "This is blue and bold"
.SelFontSize = 14
.SelColor = vbGreen
.SelText = "This is bold, green and 14 points high"
End With
End Sub
Private Sub RichTextBox1_SelChange()
Debug.Print RichTextBox1.SelColor
End Sub
'================
When you left click the mouse on a rich text box,
the rtf_selChange event will fire (amongst other
events). All of the ".sel...." properties get populated
from the character following the cursor, except for
".selColor."
If you move around in the rich text box with the
arrow keys, the ".selColor" does get updated
appropriately.
Does anybody have a work around for this?
-----------
I use the color to flag special meanings in the
word processing that we have on our back
office unix word processor. I use the colors
for five flags. I would prefer to add the five
flags as unique properties that are updated
for each character in the text box (like bold,
italics, etc. are used)
Does anybody know how to do that?
Thanks
Shane