+ Reply to Thread
Results 1 to 4 of 4

Grey out listbox rows

  1. #1
    Registered User
    Join Date
    09-03-2007
    Posts
    51

    Grey out listbox rows

    How can particular listbox rows be greyed out?
    My multicolumn listbox really needs to be able to display unmodifyable rows in a different colour, probably grey, does anyone have any idea how to accomplish this with VBA?

    Thanks for reading!

    - Gordon
    Last edited by Gordon@work; 05-20-2008 at 11:09 PM.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning Gordon@work

    The listbox is an object and has a certain number of properties which apply to the listbox as a whole. There isn't an option to colour code or disable particular items in a listbox.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

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

    DominicB is correct that there isn't an option to change the line item color. In Visual Basic it is possible because the window handle to the ListBox is accessible through VB code. By having the window handle, you can use the Windows API to change the color of a line item, along with font size, color, etc.

    It maybe possible to do this in VBA. I have some code that creates Tool Tips for line items in a ComboBox when you hover over the line. Something I didn't think was possible in VBA. Perhaps I can modify this API code to change the ListBox line item color. It's worth a try.

    Sincerely,
    Leith Ross

  4. #4
    Registered User
    Join Date
    09-03-2007
    Posts
    51

    Hi Leith

    Leith Ross you rescue me regularly with code. I have some to find the userform's window handle, but yours sounds almost ideal already, so yes please.

    Thanks very much for your thoughts.
    Sincerely,

    - Gordon

+ 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