Removing unwanted properties from a collection of masters

In addition to cleaning up how the masters looked, I also had masters that contained user and custom (AKA Shape Data) properties that were no longer needed.

Again VBA was useful.

So I used the following code to

Public Sub CleanMasters()
Dim vsoMaster As Visio.Master
Dim vsoMasterCopy As Visio.Master
Dim vsoShape As Visio.Shape
For Each vsoMaster In ActiveDocument.Masters
If vsoMaster.Type = 1 Then
Set vsoMasterCopy = vsoMaster.Open
Set vsoShape = vsoMasterCopy.Shapes(1)
If vsoShape.CellExists("User.Class", 0) Then vsoShape.DeleteRow visSectionUser, vsoShape.CellsU("User.Class").Row
If vsoShape.CellExists("Prop.Link", 0) Then vsoShape.DeleteRow visSectionProp, vsoShape.CellsU("Prop.Link").Row
vsoMasterCopy.Close
End If
Next vsoMaster
End Sub

For Custom Properties (AKA Shape Data), replace “User.” with “Prop.” and use the right name of the property and remember the section name is visSectionProp rather than visSectionUser.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Published by johnvisiomvp

The original Visio MVP. I have worked with the Visio team since 1993

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s