Dim A, B Do While Not A = -1 A = R.Find("A", B, Len(R.Text)) If A <> -1 Then R.SelStart = A R.SelLength = 1 R.SelColor = vbRed End If B = B + 1 DoEvents Loop MsgBox "Done"
Private Sub Form_Load() RichTextBox1.Text = "askldjalksdjlaks" RichTextBox1.SelStart = 5 RichTextBox1.SelLength = 4 RichTextBox1.SelColor = vbRed RichTextBox1.SelStart = 0 End Sub
Selection.Font.Color = wdColorRed
Do While Not A = -1
A = R.Find("A", B, Len(R.Text))
If A <> -1 Then
R.SelStart = A
R.SelLength = 1
R.SelColor = vbRed
End If
B = B + 1
DoEvents
Loop
MsgBox "Done"
RichTextBox1.Text = "askldjalksdjlaks"
RichTextBox1.SelStart = 5
RichTextBox1.SelLength = 4
RichTextBox1.SelColor = vbRed
RichTextBox1.SelStart = 0
End Sub
aaaaaaaaaaaaaaaaa2324bbbbbbbadfafddasfa8998afdsdasfdfasdafsdsfaa01dfsfdfd897应该将2324,8998,897 的颜色变化,能做到吗?
Selection.Font.Color = wdColorRed
同意 。