View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default VBA and Colorwheel

There is no easy way to directly do what you ask. The show method takes a
number of arguments but I believe taht the argument are passed in by value
and not bey reference so they are not modified when the code is execulted.
The argument for the colour is Arg3 so if you execute the code like this then
No colour is always the default selection...

Application.Dialogs(xlDialogPatterns).Show Arg3:=0

You cna however get the colour indirectly. Since the dialog colours the
active cell you just need to read the colour of the cell immediatly following
the colour selection. So perhaps something like this...

dim x as long
dim y as long

x = activecell.interior.colorindex
Application.Dialogs(xlDialogPatterns).Show Arg3:=0
y = activecell.interior.colorindex
activecell.interior.colorindex = x

The only trick here is to make sure that only one cell is selected when this
code is run...
--
HTH...

Jim Thomlinson


"lwm" wrote:

Thanks

This ansered my question but how do I use this to fill a variable if I put

x = Application.Dialogs(xlDialogPatterns).Show
msgbox x

I recieve true. I need to be able to use the variable in other statemnts
like changing font color.


"Gord Dibben" wrote:

Sub Foo()
Application.Dialogs(xlDialogPatterns).Show
End Sub

Will pop up the color picker dialog and color the selection with whatever color
is picked.


Gord Dibben MS Excel MVP


On Wed, 19 Dec 2007 14:16:04 -0800, lwm wrote:

I need a code example to allow the user to p;ick a color from within the
excel color wheel using VBA.

I have not been able to find one so far.
Thanks