Results 1 to 3 of 3
  1. #1
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441

    Sytem OLE to RGB


    Ok.... this is aggravating the hell out of me

    I am trying to do some conditional formatting but I want the back color to match the system button face but I am, thusfar, unable to convert the system OLE value to a RGB value. I've tried I don't know how many links but I can't get them to function and I'm feeling incredibly stupid right now.

    Here's the one that seemed closest to what I want.

    http://www.vbaexpress.com/forum/show...RGB-conversion

    But I can't get it to function. I just want to retrieve the RGB values for the COLOR_BUTTON_FACE constant, the conditional formatting wizard does not allow me to use system button face, nor does it allow me to set the transparency and avoid the backcolor altogether.

    If anyone knows how to match the conditional formatting backcolor to the system button face color, or, alternately knows how to convert a system color to RGB values please enlighten me.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I put that code in Excel workbook general VBA module. Ran the TestColors sub and set color of a cell. The color pallet shows it is RGB(240, 240, 240).
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    well, a night's sleep has made a difference I put this portion:

    Code:
    Declare Function GetSysColor Lib "user32" ( _
    ByVal nIndex As Long) As Long
    
    Public Enum Colour_Constants
    COLOR_SCROLLBAR = 0
    COLOR_BACKGROUND = 1
    COLOR_ACTIVE_CAPTION = 2
    COLOR_INACTIVE_CAPTION = 3
    COLOR_MENU = 4
    COLOR_WINDOW = 5
    COLOR_WINDOWFRAME = 6
    COLOR_MENU_TEXT = 7
    COLOR_WINDOW_TEXT = 8
    COLOR_CAPTION_TEXT = 9
    COLOR_ACTIVE_BORDER = 10
    COLOR_INACTIVE_BORDER = 11
    COLOR_APP_WORKSPACE = 12
    COLOR_HIGHLIGHT = 13
    COLOR_HIGHLIGHT_TEXT = 14
    COLOR_BUTTON_FACE = 15
    COLOR_BUTTON_SHADOW = 16
    COLOR_GRAY_TEXT = 17
    COLOR_BUTTON_TEXT = 18
    COLOR_INACTIVE_CAPTION_TEXT = 19
    COLOR_BUTTON_HIGHLIGHT = 20
    COLOR_BUTTON_DARK_SHADOW = 21
    COLOR_BUTTON_LIGHT_SHADOW = 22
    COLOR_TOOLTIP_TEXT = 23
    COLOR_TOOLTIP = 24
    End Enum


    In a module unattached to the form and voila, it now functions as it should. I probably should have mentioned I'm trying to do this in MS access not excel but you pointed me in the right direction by saying 'vba module' which prompted me to do what I did.

    Thanks June


Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums