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?

[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:
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

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
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.