Table of contents
TOC
Collapse the table of content
Expand the table of content

QBColor Function

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Returns a Long representing the RGB color code corresponding to the specified color number. SyntaxQBColor(color) The required colorargument is a whole number in the range 0-15. Settings The color argument has these settings:

NumberColorNumberColor
0Black8Gray
1Blue9Light Blue
2Green10Light Green
3Cyan11Light Cyan
4Red12Light Red
5Magenta13Light Magenta
6Yellow14Light Yellow
7White15Bright White

Remarks The color argument represents color values used by earlier versions of Basic (such as Microsoft Visual Basic for MS-DOS and the Basic Compiler). Starting with the least-significant byte, the returned value specifies the red, green, and blue values used to set the appropriate color in the RGB system used by Visual Basic for Applications.

Example

This example uses the QBColor function to change the BackColor property of the form passed in as MyForm to the color indicated by ColorCode. QBColor accepts integer values between 0 and 15.

Sub ChangeBackColor (ColorCode As Integer, MyForm As Form)
    MyForm.BackColor = QBColor(ColorCode)
End Sub
© 2017 Microsoft