Private Sub Command1_Click()
Dim MySelStart As Integer, MySelLength As Integer
'记录RichTextBox的光标位置和选定长度
MySelStart = RichTextBox1.SelStart
MySelLength = RichTextBox1.SelLength
'选定第三个字符,并且颜色设为红色
RichTextBox1.SelStart = 2
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = vbRed
'恢复之前的光标位置和选定长度
RichTextBox1.SelStart = MySelStart
RichTextBox1.SelLength = MySelLength
End Sub