Using a lnkEdit textbox to display red text substrings

chazrab

Well-known Member
Joined
Oct 21, 2006
Messages
884
Office Version
  1. 365
Platform
  1. Windows
The following code was provided by a member a year ago
{code]
Private Sub UserForm_Activate()
Dim firstpos As Integer, lastpos As Integer
Inktext.Text = "And Jesus Said to him," & Chr(34) & _
"therefore when you see the abomination of desolation standing in the Holy Place. " & Chr(34) & _
"(let the reader understand) " & Chr(34) & _
"& Chr(34) & then let him " & Chr(34) & _
"who is in Judea flee to the mountains. " & Chr(34) & _
" Matthew 24:15-16 "

Inktext.SelStart = 0
Inktext.SelLength = Len(Inktext.Text)
Inktext.SelColor = vbBlue
Inktext.SelFontSize = 18
firstpos = InStr(1, Inktext.Text, Chr(34))
lastpos = InStr(firstpos + 1, Inktext.Text, Chr(34))
Inktext.SelStart = firstpos
Inktext.SelLength = lastpos - firstpos - 1
Inktext.SelColor = vbRed
Inktext.SelLength = 0
End Sub
[/code]

I've tried and tried to replicate his code solution to add more red text, but I can't seem to figure out where and which marker
code symbols should be used and placed to display any starting and ending red text substring anywhere. See image below.


I have to do this for 3,000+ words, and I'm willing to go full throttle til its done. I just need someone who
understands how to do this based on the code block above that displays the section of red text in the image below.
(I don't find this type of textbox the easiest to use, but seems to be the only alternative in Excel to display red text substrings on a userform textbox)

Thanks sincerely for anyone's help and guidance.

cr
 

Attachments

  • REDTEXT.jpg
    REDTEXT.jpg
    107.5 KB · Views: 9

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
One of the Excel MVPs actually provided code on this forum that should help. The person requesting help wanted to make certain search terms found on different lines to be red. It should easy enough to search for, but I can take look after work if you're unable to locate it.
 
Upvote 0
One of the Excel MVPs actually provided code on this forum that should help. The person requesting help wanted to make certain search terms found on different lines to be red. It should easy enough to search for, but I can take look after work if you're unable to locate it.
Hi Dan, thanks for trying to help me.

I did a search using this phrase: "display a red text substring in a userform textbox. The search result
pulled up this post as the only one it could find. So, I would definitely like to see the post/code solution on whomever the Excel MVP is that developed a code solution to display red text substrings in a userform textbox - I couldn't find anything else out there that enables Excel to do this.

If you could help me locate this post when you get a chance, I really would very much appreciate it.
This is the only thing left to complete my application - but it is a key component.

Look forward to hearing from you.

Thx again, cr
Kingwood, Texas
 
Upvote 0
I think our posts must have crossed paths through the interwebs. Lol.
 
Upvote 0
Hi again Dan - sorry for very late reply. Went through a series of code testing for this,
and this MVP's code still doesn't work. It's possible I may have done something wrong
but I don't think so.

At issue, again, is a simple but very accurate way of inserting red text substrings anywhere between
two characters, i.e., ". Below is the image again in case you know anybody who can solve this mystery.
I have the code for this but, as mentioned earlier and above, can't seem to replicate it to successive
substrings, such as "then let him who is in Judea flee to the mountains" - in red. Once I can do that,
it just becomes a repetitive process - for the 3,000+ Words of Jesus.

Thx again, Dan W.
cr
Kingwood, Tx
 

Attachments

  • REDTEXT.jpg
    REDTEXT.jpg
    107.5 KB · Views: 4
Upvote 0

Forum statistics

Threads
1,216,419
Messages
6,130,515
Members
449,585
Latest member
kennysmith1

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