Visio Layer Transparency

Hi,
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)?
thanks
Matt
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,  http://www.VisioStepByStep.com, Scott@VisioStepByStep.com
'
' NOTES:
' 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.,
'       https://msdn.microsoft.com/en-us/vba/visio-vba/articles/layer-cellsc-property-visio
' 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

1
 
matthew cochraneAuthor Commented:
Many thanks
0
 
matthew cochraneAuthor Commented:
Thank you Scott
0
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.