color macro

A

androo...

I have a number of colored buttons on a form that, when clicked, fire the
following macro:

Private Sub Image300_Click()
On Error Resume Next
Dim Pass_color As MsoRGBType 'Define variable
Pass_color = 11954700 'Variable gets a color
Call Color_macros.Color_single_click(Pass_color) 'Pass color to macro
End Sub

This color is then passed to the following (simplified) macro:

Public Sub Color_single_click(My_color As MsoRGBType)
On Error Resume Next
'Color passed from button
Selection.Font.Color = My_color 'Change text color
End Sub

However, I would like to use RGB values such as RGB(12, 106, 182) instead of
11954700.

Can anyone tell me how I can do this?

thanks,
androo
 
D

Dave Lett

Hi,
You were close

Public Sub Color_single_click(iRed As Integer, iGreen As Integer, iBlue As
Integer)
Selection.Font.Color = RGB(iRed, iGreen, iBlue)
End Sub

Public Sub Newsgroup()
Color_single_click iRed:=12, iGreen:=106, iBlue:=182
End Sub

HTH,
Dave
 
K

Karl E. Peterson

androo... said:
I have a number of colored buttons on a form that, when clicked, fire
the following macro:

Private Sub Image300_Click()
On Error Resume Next
Dim Pass_color As MsoRGBType 'Define variable
Pass_color = 11954700 'Variable gets a color
Call Color_macros.Color_single_click(Pass_color) 'Pass color to
macro End Sub
However, I would like to use RGB values such as RGB(12, 106, 182)
instead of 11954700.

Can anyone tell me how I can do this?

Ummm, "Just do it!"?

Call Color_macros.Color_single_click(RGB(12, 106, 182))
 

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