How can I get Hex values to appear in the Visio color information

J

julied

I need to indicate the hex values of the custom colors I use in Visio. Is
there a way to get hex values to appear in addition to the RGB values in the
Colors tool window?
 
W

wr

Hi,

The color tool supports HSL and RGB values
It is not possible to get the tool to offer HEX values.
However you can use the value stored in the FillForegnd cell to get hex
values using the hex function
You can opt to call the macro from a action cell with RUNMACRO and then
store in a customer property cell for instance.

'this macro takes the RGB formula of the selected shape in the activedrawing
and convert it to hex
Sub RGBtoHEX()
Dim s As String
Dim r As Integer
Dim g As Integer
Dim b As Integer
Dim rgbhex
Dim shpObjs As Visio.Shapes
Dim shpObj As Visio.Shape
Dim vPage As Visio.Page
Set vPage = Visio.ActivePage
Set shpObjs = vPage.Shapes
Set shpObj = shpObjs.Item(1)
s = shpObj.Cells("FillForegnd").Formula
s = Mid(s, 5, (Len(s) - 5))
r = Val(Mid(s, 1, 3))
g = Val(Mid(s, 5, 3))
b = Val(Mid(s, 9, 3))
rgbhex = Hex(r) & Hex(g) & Hex(b)
Debug.Print rgbhex
End Sub

René
 

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