So I have this textbox that's actually a game chat. When someone type a message it appers like so: UserName: Message
What I want to do here is somehow make the UserName text always appear with different color, so it's kinda seperated from the actual message.
Here's the code I am currently using:
AddChatMsg 0, userName & ": " & theMsg 'send it to the chatbox
Dim curColor As Long 'current text color
Dim userNameLength As Integer 'username length
userNameLength = Len(UserName) 'store username in integer var
With MyForm.ChatText
curColor = .SelColor 'set curColor
.SelLength = userNameLength 'set Length
.SelColor = vbRed 'change color
.SelText = UserName 'not sure wha this do
.SelColor = curColor 'update current color var
End With
This actually works well, but the username is red only in the first text line:
How do I make it work for every line? Also if possible to change the font to bold will be awesome. Thank you!