Custom colors

X

XP

Using Office 2003 and Windows XP;

When you access, for example, the back color of a control there is a color
palette with built-in colors and below this is 16 squares called "Custom
colors".

1) Can someone please post generic example VBA that allows you to store
custom mixed colors in the "Custom colors" area.

2) How can I return the locations of each of the custom color squares, so I
know where the colors are going and how to refer to them later.

3) Does this setting affect all DB's or only the one in which the custom
colors are stored?

Thanks much in advance for your assistance.
 
G

GeoffG

1) Can someone please post generic example VBA that
allows you to store custom mixed colors in the
"Custom colors" area.

I don't think it's possible to write code to cycle through the custom colors
area (but would be glad to be proved wrong).

2) How can I return the locations of each of the
custom color squares, so I know where the colors
are going and how to refer to them later.

Could you adopt a different approach? For example, after choosing custom
colors, make a note of their Red, Blue and Green numbers, which are shown
after clicking the "Define Custom Colors" button.

You could then use the RGB() function to set the backcolor property of a
control, as in:

Private Sub Form_Load()

Me.txtText2.BackColor = RGB(156, 75, 84)

End Sub

Alternatively, you could get the long integer number of your custom color by
entering the following line in the Immediate window:

?RGB(156, 75, 84)

This would return the number:

5524380

You could store this number in your VBA code as a constant, e.g:

Const lngcMyCustomColor1 As Long = 5524380

You could use the constant like this:

Private Sub Form_Load()

Me.txtText2.BackColor = lngcMyCustomColor1

End Sub

3) Does this setting affect all DB's or only the
one in which the custom colors are stored?

I think the custom colors are only retained until you quit Microsoft Access.


Regards
Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top