+ Reply to Thread
Results 1 to 3 of 3

Different TextBox text colors

  1. #1
    Registered User
    Join Date
    11-05-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    2

    Different TextBox text colors

    Hi All,

    Part of my project allows a user to make text entries in what I call the “Problem Report Log”. Depending on a problem severity level which can range from ‘5’ being the lowest and ‘1’ being the highest. My design is to have each separate severity level entered to be a different colored text.- 5 purple 4 blue 3 green 2 orange and 1 red.

    I’m using a standard UserForm with a TextBox for user to enter the log entries. However, I can not work out how to have different colored text within the TextBox as when setting the TextBox's ‘Foreground’ color it applies to all text within the TextBox. I have worked out how to concatenate writing new text out to the cell in a different color by first counting how many characters already exist and then using:

    Please Login or Register  to view this content.
    The issue I am experiencing is that when the log is opened to enter a new entry I first display all previous entries from the cell back in to the TextBox (for review purposes as the actual sheet is hidden) and regardless of the color of the text in the cell ALL text then gets changed to whatever the TextBox foreground color is set to and so when the cell is updated with the new log entry and all text within the TextBox is written back to the cell the all of the text now in the cell is set to whatever the foreground colour of the TextBox had been.

    And pointers would be very much appreciated

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Different TextBox text colors

    Hello clayb04,

    The ActiveX TextBox control does not support more than one font color. The only control I know of that supports multiple font colors is a Rich Textbox Control. Unfortunately because of security issues, the Rich TextBox is not available in VBA.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    11-05-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Different TextBox text colors

    Hi Leith,

    Thanks for the response.. I guess it explains why I couldn't find a way to do it.

    Maybe the only other option I have to have some kind of affect that I wish for would be to insert multiple different colored 'images' (pictures) at the beginning of every log entry - but I have not even began to explore if that kind of option is itself possible - might you be able to shed any light on if that would be possible.

    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1