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.
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
On Error Resume Next
Visio.Application.EventsEnabled = 0
Visio.Application.EventsEnabled = -1
Will changing this will affect the visio system when drawing diagrams other than flowchart . Thanks for the add-on post please clarify.
It only effects the Cross-Functional Flowchart addon. That article was for Visio 2007 … the latest version is called CFF14, not CFF.