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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
matthew cochraneAuthor Commented:
Many thanks
0
matthew cochraneAuthor Commented:
Thank you Scott
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Visio

From novice to tech pro — start learning today.