Getting shapes and connections off visio document with VB.net

Are there "Getters" in the Visio 12.0 Type library that would allow me to programmatically get shape s and connections from a document?  I know I can write put shapes on the document using VB.net .  But I would like to reverse this process in a class library and return the information.
LVL 6
HyperBPPAsked:
Who is Participating?
 
Scott HelmersVisio Consultant, Trainer, Author, and DeveloperCommented:
Getting information about the shapes in a drawing can be as easy as the code below.

The syntax is a bit more detailed if you want to access user data fields or shape data fields for each shape. If that's part of what you want, let me know.

Getting information about connections is a bit more obscure and requires more work, because prior to the upcoming Visio 2010, there is no notion of "connectedness" in a Visio drawing. If you want that information, you have to get it yourself. For a fairly complete description of why and how, including sample code, refer to my answer to Q_24608625.

Scott

Sub GetShapeInfo()

    Dim pg As Visio.Page
    Dim shp As Visio.Shape
    
    For Each pg In ActiveDocument.Pages
        For Each shp In pg.Shapes
            ' do something here with info about shape, e.g.
            Debug.Print shp.Name
        Next
    Next
    
End Sub

Open in new window

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.