Windows Colour Dialog (aka ChooseColorA) - can the "basic" colours be changed?

AOB

Registered User.
Local time
Today, 02:04
Joined
Sep 26, 2012
Messages
633
Does anybody know if, when calling the Windows Colour Dialog (to provide an option for a user to select a colour for something) :

Open the Windows Color Dialog from VBA

...is it possible to define, set or change, the Basic Colours that are loaded into that dialog (as opposed to the Custom Colours, which can, as is seen within the code, be very easily pre-defined via an array of Long variables)

That is, the block of 8x6 colours at the top, as opposed to the block of 8x2 colours at the bottom?

I find the standard / stock set fairly useless, as many of them are either incredibly similar (there are 5 different greens that are barely distinguishable to the naked eye), or quite garish / loud. Basically, nobody in their right mind would choose any of them and even fewer are going to be willing/bothered going to the trouble of manually working out the red, green and blue constituents to find something vaguely resembling the colour they actually want.

I'd much prefer to pre-define them to be similar to the "Theme Colours" that you get in Excel when formatting font or interior (i.e. 10 columns of basic colours, graduating from lighter to darker down 6 rows) or the similar colour-picker options in the Design view for a form when you modify any of the colour attributes of a control (e.g. Back Color, Fore Color etc.)

(Obviously 60 into 48 won't go; I'm not looking for an exact reproduction here, this is just an example!! Also, I know I've already stated above, I can always pre-define the custom colours instead, but that only gives me 16 shades to play with, when there are 48 directly above going to waste)

I know Excel has things like Application.Dialogs(xlDialogEditColor) and Application.Dialogs(xlDialogColorPalette) etc. but they're not accessible from Access (at least, not without loading up an instance of Excel, which is overkill when all I want is a simple integer representation of a user-selected colour)

The ChooseColor API is pretty much perfect for my requirements apart from the fact the colours it starts off with are terrible!

Any suggestions?
 
Solution
Here is a more updated version to mimic the color picker in Access, but give you the "more color" capability. So the More Colors opens the vba version and passes the value back to the custom form. The form in the middle just needs to be completed with the rest of the colors.

I did not code the recent colors, but that can be done using Tempvars. I think the trick to that is once you fill up the 10 recent colors you need to start overwriting them. So you need to track the next one to fill and cycle if going past 10 recent.

The other thing is you might want to standardize the look and functionality. The VBA picker has Ok Cancel and the Access closes when you pick a color. The vba then formats the border of the selected color. VBA has...

Users who are viewing this thread

Back
Top Bottom