Visio Guy

Visio Discussions => Programming & Code => Topic started by: Hlavender on September 14, 2017, 11:01:23 PM

Title: How to print one layer at a time automatically using a macro
Post by: Hlavender on September 14, 2017, 11:01:23 PM
Hi

I have a Visio document with over 40 layers in it

I want to loop through  each of the layers and print them out - in another words When the macro runs, it should print layer 1, then print layer 2, etc.

Can you help me with the vba code that would allow me to do this?
Title: Re: How to print one layer at a time automatically using a macro
Post by: OldSchool1948 on October 26, 2017, 08:41:21 PM
This may help some


Private Sub PrintLayersOnAllPages()
    Dim vsoPage As Visio.Page
    Dim vsoLayer As Visio.Layer
    For Each vsoPage In Visio.ActiveDocument.Pages
        Debug.Print vsoPage.Name
        For Each vsoLayer In vsoPage.Layers
            Debug.Print vsoLayer.Name
        Next vsoLayer
        Debug.Print Chr(10)
    Next vsoPage
End Sub