Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

color macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
androo... - 06 Nov 2006 18:49 GMT
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
Dave Lett - 06 Nov 2006 19:00 GMT
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

>I have a number of colored buttons on a form that, when clicked, fire the
>following macro:
[quoted text clipped - 21 lines]
> thanks,
> androo
Karl E. Peterson - 06 Nov 2006 19:19 GMT
> I have a number of colored buttons on a form that, when clicked, fire
> the following macro:
[quoted text clipped - 5 lines]
>     Call Color_macros.Color_single_click(Pass_color) 'Pass color to
> macro End Sub
<snip>
> 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))

Signature

Working without a .NET?
http://classicvb.org/

androo... - 06 Nov 2006 22:00 GMT
Thanks. Both of these work perfectly.

androoooooooooooo.....................
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.