0

I am using excel 2010. I have a textbox with a multi-color message in it.

enter image description here

I would like for it to stay in place when I scroll through my worksheet.

I've searched google for it and came up with this solution:

http://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_other/how-to-create-a-floating-text-box-in-excel/59c7533c-c5b3-4096-bef2-4e9bac2176bf?auth=1

It uses userforms and textboxes from VBA. My question now is: how can I give the text that is displayed in the textbox a certain color (so that it matches the text box I already have)? And if this is not possible, how can I 'lock' the text box I have to keep it visible at all times?

Edit

It was suggested to use an activeX textbox and I tried that, but I don't know which property I should change.

View of my excel file and the textbox I'm try to edit

3
  • I am using a text box from the insert tab and then shapes. I'll try using a macro to see what code changes the color!
    – Michthan
    Sep 28, 2016 at 11:40
  • @ejbytes I tried recording a macro to change the text in my textbox, but I don't know how to modify it to change the text in my userform. I also tried running the floating text box with the userform and the recording a macro to change the color of it. But it was impossible to change the color.
    – Michthan
    Sep 28, 2016 at 12:01
  • @ejbytes I tried using an ActiveX textbox, but I still can't give it color, do you have any suggestions?
    – Michthan
    Sep 30, 2016 at 6:10

1 Answer 1

0

To change the color of the text in a userform, use this line:

userFormName.TextBox1.ForeColor = &H00AABBCC&

Where userFormName is the name of the form, and TextBox1 is the name of the object you want to change color of.

The first 2 zero's in the &H value are used to flag whether the colour is a system colour, like button face or windows background.
AABBCC is like a normal hex RGB code, but backwards.
AA is blue, BB is Green and CC is the value for red.
So &H000000FF& would be red.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.