Visio Layer Transparency

In Visio, is it possible using vba to show a layer at different levels of transparency (one after the other until the layer is fully visible)?
matthew cochraneAsked:
Who is Participating?
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Interesting idea, and the answer is yes. One thing to watch out for: the layer in question must have a color assigned (even if it's white) in order for the transparency setting to have any effect.

Sub SetLayerTransparency()
' sets layer transparency
' Scott Helmers,,
' 1) The CellsC property of the layer object takes an integer column number; the code below uses a predefined
'    enum to identify the color transparency column. Refer to the Visio SDK for enum lists, e.g.,
' 2) The value for color transparency must be <= 1

    Const sLayerName    As String = "TestLayer"
    Dim pg              As Visio.Page
    Dim lyr             As Visio.Layer
    Set pg = ActivePage                                     ' get active page
    Set lyr = pg.Layers(sLayerName)                         ' get desired layer
    lyr.CellsC(Visio.visLayerColorTrans).FormulaU = 0.5     ' set transparency to 50%
End Sub

Open in new window

matthew cochraneAuthor Commented:
Many thanks
matthew cochraneAuthor Commented:
Thank you Scott
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.