A colleague recently asked me how to close the Shape Data Sets window so that it does not automatically re-open when you open the drawing again. My first thoughts was that this is surely a simple matter of saving the workspace, but it appears that this is not the case! I found that other Visio users have had the same problem, so I thought I would present my solution (until Microsoft fix it!).
The window is opened from the right mouse menu of the Shape Data window.
The Shape Data Sets window has a right-mouse menu option to Close it, and it has the normal X button to close it. Indeed, this does hide the window, but it automatically re-opens whenever the document is re-opened.
A little investigation reveals that the add-on; named "cpm" for Custom Property Management, I guess; creates two persistent events in the document, a SolutionXMElement, and User-defined cell. So, I found it necessary to write a macro to remove all of these items from the document.
Public Sub CleanShapeDataSets()
Dim win As Visio.Window
For Each win In Visio.ActiveWindow.Windows
If win.Caption = "Shape Data Sets" Then
win.Visible = False
win.Close
End If
Next
If Visio.ActiveDocument.SolutionXMLElementExists("CustomPropertySets") Then
Visio.ActiveDocument.DeleteSolutionXMLElement "CustomPropertySets"
End If
If Visio.ActiveDocument.DocumentSheet.CellExists("User.CPMState", Visio.visExistsAnywhere) Then
Visio.ActiveDocument.DocumentSheet.DeleteRow Visio.visSectionUser, Visio.ActiveDocument.DocumentSheet.Cells("User.CPMState").Row
End If
Dim evt As Visio.Event
Dim i As Integer
For i = Visio.ActiveDocument.EventList.Count To 1 Step –1
Set evt = Visio.ActiveDocument.EventList.Item(i)
If evt.Persistent Then
If evt.Target = "cpm" Then
evt.Delete
End If
End If
Next
End Sub
The macro can be stored in any Visio document, but just run it when you want to permanently close the Shape Data Sets window on the active document.