Changing forecolor of certain words in Rich Text Box

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,097
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
How might this done please? Have tried various methods without success e.g.

With RichTextBox1
.Text = "<font color="green"> Welcome to BLAHG BLAH. </font>"
.Select(richTextBox1.TextLength - 4, 4)
End With

The Only Excel-specific instructions I could find were for RTB on Worksheet whereas mine is on a Userform. And the to-be colored text is not selected. It's intended as a heading.
Thanks for any help.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
If the control contained "this is a test" then this should colour "is a" as red
VBA Code:
With InkEdit1
    .SelStart = 5
    .SelLength = 4
    .SelColor = vbRed
    .SelLength = 0
End With
You would need an event that will trigger that code.
 
Upvote 0
I believe its proper name is InkEdit control. You probably have that. Try Tools>more controls if it's not already in your toolbox.
 
Upvote 0
There used to be a RichTextbox, but it was disabled in (I think) 2003 for security reasons & was only available on 32bit versions of Excel.
 
Upvote 0
I've Office 2010 and it's listed under Additional Controls - Microsoft Rich Textbox Control SP6 with Location
C:\WINDOWS\system32\RICHTX32.OCX. In Office 2019 the location is Location C:\WINDOWSKSysWOWE'Mrichtx32.ocx
But after much hunting I can find nothing on how it's used.
I had tried InkEdit and it was nearly ok, but you could not bold just some text, it affected everything.
I'm looking for some way to have text with headings colored/bold and remaining text black/regular.
 
Upvote 0
but you could not bold just some text, it affected everything.
The order in which you format the font may be important. However, your post said nothing about bold. It was about forecolor.
1729995730915.png
 
Upvote 0
I didn't mention bold as I believe a rich text box will do that, certainly the one in Access does (but I couldn't get the Excel one do anything except show plain text.)
What was the method you used for red bolded? This is with InkEdit?
Could you do this

Heading 1 (Red Bold)
Some plain text black
Heading 2 (Blue Bold)
some plain text black

etc...
 
Upvote 0
Yes it is InkEdit but I don't know what you mean by the rest of that. Could you post an example of what you mean?
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,139
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top