E
ExcelMonkey
I am trying to integrate John Walkenbachs colour palette
routine into a marco that I have written.
http://www.j-walk.com/ss/excel/tips/tip49.htm
I am trying to use it with a form that has multiple
buttons on it. I want to be able to call the colour
palette from multiple buttons. That is, each button is
essentially a colour option button. I then want the
button that is clicked to take the colour of the palette
colour chosen.
The snippet below from the JW code below shows how he
takes the colour chosen from the palette and then uses it
to colour a shape called "donut".
I know I can simply call the main sub from each button
click event. However as I have to also ensure that the
sub below knows which button to colour, I am assuming
that this may entail some other coding for the separate
buttons. Does the coding for the buttons need to go into
a Class Module?
Thanks
'Sub Test_GetAColor1()
'' Example of using the GetAColor function
'' This sub prompts for a color, then changes
'' the color of a shape named Donut
Dim UserColor As Long
Dim OldSelection As Object
Set OldSelection = Selection
UserColor = GetAColor()
If UserColor <> False Then
ActiveSheet.Shapes("Donut").Select
Selection.ShapeRange.Fill.ForeColor.RGB =
UserColor
Selection.ShapeRange.Line.ForeColor.RGB =
UserColor
OldSelection.Select
End If
End Sub
routine into a marco that I have written.
http://www.j-walk.com/ss/excel/tips/tip49.htm
I am trying to use it with a form that has multiple
buttons on it. I want to be able to call the colour
palette from multiple buttons. That is, each button is
essentially a colour option button. I then want the
button that is clicked to take the colour of the palette
colour chosen.
The snippet below from the JW code below shows how he
takes the colour chosen from the palette and then uses it
to colour a shape called "donut".
I know I can simply call the main sub from each button
click event. However as I have to also ensure that the
sub below knows which button to colour, I am assuming
that this may entail some other coding for the separate
buttons. Does the coding for the buttons need to go into
a Class Module?
Thanks
'Sub Test_GetAColor1()
'' Example of using the GetAColor function
'' This sub prompts for a color, then changes
'' the color of a shape named Donut
Dim UserColor As Long
Dim OldSelection As Object
Set OldSelection = Selection
UserColor = GetAColor()
If UserColor <> False Then
ActiveSheet.Shapes("Donut").Select
Selection.ShapeRange.Fill.ForeColor.RGB =
UserColor
Selection.ShapeRange.Line.ForeColor.RGB =
UserColor
OldSelection.Select
End If
End Sub