RGB Colors of "Fill Color"

B

Brad

Thanks for taking the time to read my question.

I want to make a form on which the user can choose the fill color. I want
to have something that looks like what you find on the Formatting tool bar
for Fill Color. I thought I'd use option boxes inside a group. Instead of
having a caption, I thought I'd just set the BackColor to the fill color to
be used.

My problem is that when you drop down the BackColor list in the Properties
box, it doesn't give you many options Pallet or otherwise. I thought I could
set the BackColor programatically, but I can't seem to find the RGB values of
the available colors.

Thanks,

Brad
 
B

Bob Phillips

Brad,

You could add a picker button on the form to call the built-in colour dialog
Function ReturnColorindex() As Long
Dim rngCurr As Range
Set rngCurr = Selection
Application.ScreenUpdating = False
Range("IV1").Select
Application.Dialogs(xlDialogPa­tterns).Show
ReturnColorindex = ActiveCell.Interior.ColorIndex
ActiveCell.Interior.ColorIndex = xlColorIndexAutomatic
rngCurr.Select
End Function
 
B

Brad

Hi Bob,

Thanks for the code.

I put it into my form, and called it on the Click event of a button


Private Sub CommandButton1_Click()
MsgBox ReturnColorindex
End Sub

Your code gets stuck on [Application.Dialogs(xlDialogPa­tterns).Show]

not sure how to fix it.

Brad
 
B

Bob Phillips

Brad,

I think it is a Google problem.

If you look at the code in the VB IDE, you will probably see it says

Application.Dialogs(xlDialogPa-­tterns).Show

that is an extra -. Remove that -, to

Application.Dialogs(xlDialogPatterns).Show

--
HTH

Bob Phillips

Brad said:
Hi Bob,

Thanks for the code.

I put it into my form, and called it on the Click event of a button


Private Sub CommandButton1_Click()
MsgBox ReturnColorindex
End Sub

Your code gets stuck on [Application.Dialogs(xlDialogPa­tterns).Show]

not sure how to fix it.

Brad


Bob Phillips said:
Brad,

You could add a picker button on the form to call the built-in colour dialog
Function ReturnColorindex() As Long
Dim rngCurr As Range
Set rngCurr = Selection
Application.ScreenUpdating = False
Range("IV1").Select
Application.Dialogs(xlDialogPa­tterns).Show
ReturnColorindex = ActiveCell.Interior.ColorIndex
ActiveCell.Interior.ColorIndex = xlColorIndexAutomatic
rngCurr.Select
End Function


--
HTH

Bob Phillips

Instead
of color
to I
could values
of
 
B

Brad

Hi Bob,

I found the problem. I should have noticed it right away... bit of a brain
stall there.

Thanks,

Brad
 

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