VBA constant colors

  • Thread starter Thread starter Andrew Vaudin
  • Start date Start date
A

Andrew Vaudin

Can anyone tell me how to define and use a constant color called, for
instance, 'my_blue' that can be used anywhere in a PowerPoint add-in to
replace code such as:

- ActiveWindow.Selection.TextRange.Font.Color.RGB = RGB(Red:=12,Green:=106,
Blue:=182)

- Dim current_Color As Long
current_Color = RGB(12,106,182)

- ActiveWindow.Selection.ShapeRange.Fill.ForeColor.RGB = RGB(12,106,182)

Thanks,
androoo...
 
For that specific color, you want

Const constMyBlue= 1195470

There is probably an easier way to figure it out, but what I did is write a procedure that ran the following lines

my_blue = RGB(Red:=12, Green:=106, Blue:=182
MsgBox my_blu

This told me that your combination of RGB values comes out to 11954700. Change the RGB values to get a different color

--Davi

----- Andrew Vaudin wrote: ----

Can anyone tell me how to define and use a constant color called, fo
instance, 'my_blue' that can be used anywhere in a PowerPoint add-in t
replace code such as

- ActiveWindow.Selection.TextRange.Font.Color.RGB = RGB(Red:=12,Green:=106
Blue:=182

- Dim current_Color As Lon
current_Color = RGB(12,106,182

- ActiveWindow.Selection.ShapeRange.Fill.ForeColor.RGB = RGB(12,106,182

Thanks
androoo..
 
David M. Marcovitz said:
For that specific color, you want:

Const constMyBlue= 11954700

There is probably an easier way to figure it out, but what I did is write a
procedure that ran the following lines:
my_blue = RGB(Red:=12, Green:=106, Blue:=182)
MsgBox my_blue

This told me that your combination of RGB values comes out to 11954700. Change the
RGB values to get a different color.
Or to keep the reason for the definition within the code, you could:

Dim my_blue as Long
my_blue = RGB(12,106,182)
 
Back
Top