Change the color of each capital letter in a rich text memo field.


Joined
Sep 10, 2013
Messages
1
Reaction score
0
I have a rich text memo field, I need have all the capital letters changed from black to red after an update on another field. I have been able to do this with the replace function for commas and periods but I cannot for the life of me figure out how to do this with capital letters. Any help would be much appreciated.

Code:
Private Sub GrammarText_AfterUpdate()
If Len(Me.GrammarText) < 417 Then
Me.CorrectText = Me.GrammarText

Me.NoPeriods = Replace(Me.GrammarText, ".", " ")
Me.NoCommas = Replace(Me.GrammarText, ",", " ")

Me.CorrectText = Replace(Me.CorrectText, ".", "<font color=""red"">.</font>")
Me.CorrectText = Replace(Me.CorrectText, ",", "<font color=""red"">,</font>")

Else
MsgBox "Text is too large, please reduce the amount of characters"

End If
End Sub
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top