How to set multi color value into a textbox in vba RRS feed

  • Question

  • I have a worksheet in which there is cell(20,11) and the value or data  in it is in multiple color(apple(green color) bat (red color))  and i want to pick the cell value or data along with the color and display as it is in the text box of user form ?
    Friday, May 2, 2014 11:00 AM

All replies

  • NOTE:  Same question posted in Excel IT Pro Discussions forum
    Re: UserForm Textbox colors

    (code in userform module)
    Me.TextBox1.ForeColor = Worksheets("Sheet1").Range("K20").Font.Color
    Me.TextBox1.BackColor = Worksheets("Sheet1").Range("K20").Interior.Color

    Jim Cone
    Portland, Oregon USA (Dropbox)
    (free & commercial excel add-ins & workbooks)

    • Edited by James Cone Tuesday, October 25, 2016 1:27 AM
    Friday, May 2, 2014 6:05 PM
  • Are you saying you want to display font with multiple colours? If so that's not available with the form's standard textbox.

    There is an old MS control RichTextBox that can handle mixed fonts but with this ActiveX control there are some security issues with it. From memory I don't think it's installed as standard on Win7 but have a look - on the 'toolbox' right click, Additional controls, tick "Microsoft Rich Textbox Control 6.0 (SP6)" (if it's there).

    Even if you have it there may be problems distributing your project.

    Saturday, May 3, 2014 10:27 AM