Report background and foreground color change using VBA

baba

Registered User.
Local time
Today, 07:27
Joined
Nov 15, 2011
Messages
39
Could you please tell me how to change background color of MSAccess Reports using VBA? How can I do border coloring. What are the vba codes for all color options like light green, light blue etc.
How to change the font type to bold etc using vba
I did some changes to text box coloring in Detail Section on format click event.
Thanks for the help !
 
there are no direct colour codes for most colours. the colours themselves are very large numbers ( in the range 0 to 2^24 - hence 24 bit colours - 3 8bit words representing values for each of red, green and blue)

the rgb function mixes red, green and blue to provide a colour, taking values in range 0 to 255 for each of red, green and blue, to return the actual long integer value

so rgb(255,0,0) is red
rgb (0,255,0) is green
rgb (0,0,255) is blue
rgb(255,255,255) is white
rgb(128,128,128) will be a mid grey

full red evaluates as 256-1
full green as 256*256 -1
full blue as 256 * 256 * 256 -1

so something like rgb(128,255,128) will be a green tinted neutral colour. the higher the numbers the paler the colour.

a colour picker chart might show you the values, otherwise its a matter of playing around to find the colour value you want.

pick a colour you like from the palette and see what number it is. there is no direct way to get the rgb values from a colour number, although a bit of maths can calculate them.
 
Last edited:
Thank you for the help. This is cool !
 

Users who are viewing this thread

Back
Top Bottom