Search code examples
vb.netfiltershapesvisiobasic

Filter shapes by master in visio using Visual Basic


So here is the setup: I'm using Visio creating a diagram using different shapes from stencils. Later I will have excel files with data connected to the different kind of shapes. The excel files will be updated fairly regularly. Since the diagram is going to be quite complex, so Shapes are going to have hyperlinks linking to shapes in the current document. For the hyperlinks I like to name the shapes according to their meaning. This will be done by hand and once.

So what I'm trying to accomplish now is to programmatically change the shape data matching the shape name. Since the different kind of shapes have different data sets assigned I need a way to filter the shapes in the document by their kind/appearance. For example: Triangles have a date assigned as shape data and Rectangles a zip code. Having two triangles named Bert and Ernie and three rectangles named Huey, Dewey, and Louie the respective shape data shall by assigned.

How can I determine which in the collection of shapes in a sheet-Object is a triangle and which a rectangle?

Btw: the Master-Property has a Name and NameU (and more fields), but those are changed when you give the shape a name. This is what I tried so far. No Luck.

Any suggestion would be greatly appreciated.

Dacrow28


Solution

  • Since I can't mark the comment of surrogate as answer I'm gonna quote him.

    PS if you change master-shape name, shp.Master.NameU property contain native master-shape name !

    Thx Surrogate. Thats the one. I completely overlooked Master and totally concentrated erroneously on MasterShape. shp.Master.NameU and shp.Master.Name don't change when giving the entity/shape a shape name.