Skip to content

Reply To: ChatSend with Text Color Format

#189637
Johnny5
Member

‘**************************************************************************
‘USAGE:
‘ ColorWord (“blue”), vbBlue, 10, True, False
‘ ColorWord (“red”), vbRed, 10, True, False
‘ ColorWord (“cyan”), vbCyan, 10, True, False
‘ ColorWord (“green”), vbGreen, 10, True, False
‘ ColorWord (“magenta”), vbMagenta, 10, True, False
‘ ColorWord (“yellow”), vbYellow, 10, True, False
‘**************************************************************************

Public Function ColorWord(Swords As String, Scolor As ColorConstants, _
SFontsize As Integer, Sbold As Boolean, Sitalic As Boolean)
Dim search&
search = 1
Do Until search = 0
search = InStr(search, frmRTB.rtb.text, Swords, vbTextCompare)
If search > 0 Then
With frmRTB.rtb
.SelStart = search – 1
.SelLength = Len(Swords)
.SelColor = Scolor
.SelFontSize = SFontsize
.SelBold = Sbold
.SelItalic = Sitalic
End With
search = search + Len(Swords)
End If
Loop
With frmRTB.rtb
.SelStart = Len(frmRTB.rtb.text)
.SelColor = vbGreen
.SelFontSize = 8
.SelBold = False
.SelItalic = False
End With
End Function