VBA color picker / palette - just like in font dialog

C

csugden

Hi,

I've had a look at a lot of color picking code for userforms, but I was
wondering if there was any way of just producing the same combo box
that can be found in Format-->Cells-->Font (I'm using Excel).

I've looked at various application.dialogs, but they would confuse my
users - all I need is the colour, and the way it is done in the Font
page seems ideal.

Either an inbuilt solution (i.e. something within excel that I can
reference, like a dialog) or a copy would be fine. Anyone seen anything
like this?

Thanks very much,

Chris
 
Z

zz

draw a few frame controls on a userform, color them in different colors,
then in the click event change a variable of the type variant to get the
value of the color the frame is colored

eg.

dim mycolor as variant
set mycolor=frame(i).backcolor

then when you need the color you do like:

me.backcolor=mycolor


just an idea can tell if it works cus i have no excel right now. :=(
 
C

csugden

Hiya, thanks, that sounds like it'll work. I was hoping I could just
make a call to something that already existed in the program, but I
think that's optimistic.

Cheers,

Chris
draw a few frame controls on a userform, color them in different colors,
then in the click event change a variable of the type variant to get the
value of the color the frame is colored

eg.

dim mycolor as variant
set mycolor=frame(i).backcolor

then when you need the color you do like:

me.backcolor=mycolor


just an idea can tell if it works cus i have no excel right now. :=(


--
---
zz [MX]
cuasi-musico,semi-poeta y loco


Hi,

I've had a look at a lot of color picking code for userforms, but I was
wondering if there was any way of just producing the same combo box
that can be found in Format-->Cells-->Font (I'm using Excel).

I've looked at various application.dialogs, but they would confuse my
users - all I need is the colour, and the way it is done in the Font
page seems ideal.

Either an inbuilt solution (i.e. something within excel that I can
reference, like a dialog) or a copy would be fine. Anyone seen anything
like this?

Thanks very much,

Chris
 
Z

zz

I guess that the color dialog would work, but since you told those were
confusing, the logical solution would be to simplify the dialogs.

by the way, disregard my suggestion about using frames, instead you should
use labels or other type of controls, i just tried my solution and it took
forever to launch the simplest userform.


--
:=) glad to help.
---
zz [MX]
cuasi-musico,semi-poeta y loco



Hiya, thanks, that sounds like it'll work. I was hoping I could just
make a call to something that already existed in the program, but I
think that's optimistic.

Cheers,

Chris
draw a few frame controls on a userform, color them in different colors,
then in the click event change a variable of the type variant to get the
value of the color the frame is colored

eg.

dim mycolor as variant
set mycolor=frame(i).backcolor

then when you need the color you do like:

me.backcolor=mycolor


just an idea can tell if it works cus i have no excel right now. :=(


--
---
zz [MX]
cuasi-musico,semi-poeta y loco


Hi,

I've had a look at a lot of color picking code for userforms, but I was
wondering if there was any way of just producing the same combo box
that can be found in Format-->Cells-->Font (I'm using Excel).

I've looked at various application.dialogs, but they would confuse my
users - all I need is the colour, and the way it is done in the Font
page seems ideal.

Either an inbuilt solution (i.e. something within excel that I can
reference, like a dialog) or a copy would be fine. Anyone seen anything
like this?

Thanks very much,

Chris
 

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