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


John Marshall… Visio MVP

Published by johnvisiomvp

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