VB6 Finding the RGB values of a color

February 2017

A VB6 or (Visual Basic 6) program can be used to find RGB values of a color. Some knowledge of programming concepts and languages such as Visual Basic is required to write a program code in VB6. Basic concepts and knowledge of bit operations, functions, subroutines, etc, are necessary to write programs. A program to find the RGB values of a color in VB6 can be written by using basic bit operations. With binary operations and Visual Basic, finding the RGB values of a color can be accomplished in a few lines of code.

Dim R as integer     
Dim G as integer
Dim B as integer

Sub FindRGB(Col As Long)
R = &HFF& And Col
G = (&HFF00& And Col ) \ 256
B = (&HFF0000 And Col ) \ 65536
End Sub

Note: Here is a link to more than 500 color descriptions:


Published by deri58. Latest update on October 19, 2016 at 04:39 PM by owilson.
This document, titled "VB6 Finding the RGB values of a color," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).