Bryan Ward

Logo

About

All Posts

Recordings

Contact

Close all open stencils in Visio

12 August 2019

If you’re like me, you’ve probably got every stencil from every vendor always open in Visio. This macro code will close them all in one go.

Sub CloseAllStencils()

    'Enable diagram services
    Dim DiagramServices As Integer
    DiagramServices = ActiveDocument.DiagramServicesEnabled
    ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150

    For Each doc In Application.Documents
        If doc.Type = visTypeStencil Then
            Debug.Print (doc.Name)
            doc.Close
        End If
    Next
    'Application.ActiveWindow.Windows.ItemEx("CCH-CP12-91").Close

    'Restore diagram services
    ActiveDocument.DiagramServicesEnabled = DiagramServices

End Sub

tags: code - visio

I certify that none of the text contained within the articles on this site has been generated or edited by any AI technology. I've been a fan of the em dash for many years and am known to use big words from time to time.
This page uses cookies — if that's a problem, then don't use the Internet.
Copyright © Bryan Ward