Site icon bVisual

Turning OFF The Cross Functional Flowchart Addon in Visio

Following on from my last blog, my colleague also needs to stop the Cross Functional Flowchart behaviour in a Visio Diagram.  Well, I was almost fooled again into thinking that it might be as simple as removing the Persistent Events using the tool in the Visio SDK.

image

Well, deleting them was no problem, but the DocumentOpened event was re-added as soon as the document was saved.  A little investigation revealed that there are 56 EventList items in a Cross Functional Flowchart diagram (after deleting the two PersistentEvents), but only 44 in a standard Visio document (on my Visio 2007 Pro installation).  So, there are an extra 12 that have been added … just ready to spring back into life when the actions they are listening to are fired.  One of these must be the DocumentSaved event, so simply disabling the events before saving (and remembering to switch them back on), allowed me to remove the Cross Functional Flowchart add-on.

One caveat, dragging a Functional band master back onto a page will switch it back on again.

Public Sub RemoveCFF()
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 = True Then
            If evt.Target = "CFF" Then
                Debug.Print evt.Target
                evt.Delete
            End If
        End If
    Next

    On Error Resume Next
    Visio.Application.EventsEnabled = 0
    Visio.ActiveDocument.Save
    Visio.Application.EventsEnabled = -1
End Sub

Exit mobile version