Home
%3CLINGO-SUB%20id%3D%22lingo-sub-237302%22%20slang%3D%22en-US%22%3EAutomatic%20Behaviors%20in%20Visio%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-237302%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Aug%2C%2024%202007%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3ESeveral%20people%20have%20posted%20in%20the%20newsgroups%20about%20Visio%20moving%20shapes%20around%20unexpectedly%20-%20particularly%20when%20documents%20are%20opened%20or%20saved.%26nbsp%3B%20This%20random%20behavior%20can%20be%20infuriating%20to%20users.%26nbsp%3B%20Perhaps%20more%20frustrating%20is%20that%20Visio%20may%20continue%20moving%20shapes%20around%20after%20the%20user%20has%20%22fixed%20up%22%20their%20diagram%20again.%26nbsp%3B%20This%20post%20looks%20at%20automatic%20behaviors%20and%20tries%20to%20shine%20some%20light%20on%20the%20issues.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CH3%20id%3D%22toc-hId-1451050590%22%20id%3D%22toc-hId-1619851231%22%3EConnector%20Routing%3C%2FH3%3E%0A%20%20%3CP%3EPerhaps%20the%20most%20common%20automatic%20activity%20in%20Visio%20is%20connector%20routing.%26nbsp%3B%20Visio%20ensures%20that%20connectors%20stay%20glued%20to%20shapes%20when%20those%20shapes%20are%20moved%20around%20the%20page.%26nbsp%3B%20Visio%20also%20finds%20the%20optimum%20route%20for%20connectors%20that%20will%20avoid%20other%20shapes%20along%20the%20path.%26nbsp%3B%20Finally%20line%20jumps%20are%20added%20to%20connectors%20that%20cross%20over%20other%20connectors.%26nbsp%3B%20Historically%2C%20crazy%20connector%20routing%20has%20been%20a%20frequent%20complaint%2C%20but%20routing%20logic%20has%20gotten%20significantly%20better%20over%20time.%26nbsp%3B%20Recent%20versions%20of%20Visio%20do%20a%20pretty%20good%20job%20with%20routing.%26nbsp%3B%20While%20users%20may%20object%20to%20the%20routes%20chosen%2C%20there%20are%20very%20few%20reports%20of%20routes%20randomly%20changing%20in%20the%20diagram.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EIf%20you%20are%20encountering%20routing%20issues%20in%20your%20diagram%2C%20you%20might%20find%20this%20%3CA%20href%3D%22http%3A%2F%2Fblogs.msdn.com%2Fvisio%2Farchive%2F2006%2F09%2F15%2F756352.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Eearlier%20post%20%3C%2FA%3Ehelpful.%26nbsp%3B%20You%20can%20also%20reduce%20the%20number%20of%20situations%20where%20connector%20routes%20are%20changed.%26nbsp%3B%20Go%20to%20Format%20%26gt%3B%20Behavior%20and%20then%20the%20Connector%20tab%20and%20adjust%20the%20Reroute%20property.%26nbsp%3B%20Reroute%20%3D%20Never%20means%20that%20Visio%20will%20maintain%20glue%20but%20never%20recompute%20the%20route%20to%20optimize%20it.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CH3%20id%3D%22toc-hId--1101106371%22%20id%3D%22toc-hId--932305730%22%3ESolution%20Behaviors%3C%2FH3%3E%0A%20%20%3CP%3EThe%20second%20type%20of%20automatic%20behaviors%20involve%20Visio%20solutions.%26nbsp%3B%20In%20this%20case%20we%20are%20referring%20to%20the%20Visio%20add-ons%20that%20provide%20extra%20capabilities%20for%20individual%20diagram%20types.%26nbsp%3B%20For%20example%2C%20the%20Organization%20Chart%20solution%20is%20responsible%20for%20providing%20features%20such%20as%20dropping%20subordinates%20on%20top%20of%20managers%2C%20generating%20a%20diagram%20using%20the%20Organization%20Chart%20Wizard%20or%20synchronizing%20organizations%20across%20pages.%26nbsp%3B%20You%20may%20not%20think%20of%20these%20capabilities%20as%20add-ons%20because%20Visio%20tries%20to%20make%20the%20functionality%20seem%20as%20integrated%20as%20possible%20with%20the%20core%20diagramming%20features.%3C%2FP%3E%0A%20%20%3CP%3EMost%20frequently%20we%20hear%20about%20random%20shape%20movement%20with%20the%20Organizational%20Chart%20and%20Cross-functional%20diagram%20types.%26nbsp%3B%20However%2C%20users%20have%20reported%20issues%20with%20a%20number%20of%20diagrams%20such%20as%20Gantt%20Charts%20and%20Timelines%20too.%26nbsp%3B%20The%20root%20cause%20for%20random%20shape%20movement%20is%20that%20a%20diagram%20has%20solution%20managing%20the%20position%20of%20shapes%2C%20and%20something%20is%20triggering%20that%20solution%20to%20make%20it%20move%20shapes%20around%20the%20page.%26nbsp%3B%20These%20solutions%20get%20in%20trouble%20when%20they%20fail%20to%20realize%20that%20a%20shape%E2%80%99s%20current%20position%20has%20been%20designated%20by%20the%20user%20and%20is%20no%20longer%20under%20the%20complete%20control%20of%20the%20solution.%3C%2FP%3E%0A%20%20%3CP%3EVisio%E2%80%99s%20solutions%20that%20manage%20the%20position%20of%20shapes%20on%20the%20page%20can%20tolerate%20varying%20degrees%20of%20customization%20by%20the%20user.%26nbsp%3B%20Sometimes%20it%20is%20okay%20for%20a%20shape%20to%20be%20in%20a%20different%20location%20than%20what%20the%20solution%20wants%2C%20and%20sometimes%20the%20solution%20is%20not%20capable%20of%20leaving%20a%20shape%20in%20a%20different%20location.%26nbsp%3B%20Many%20problems%20arise%20when%20the%20user%20takes%20additional%20steps%20to%20prevent%20automatic%20behavior%20such%20as%20grouping%20shapes%2C%20replacing%20connectors%20with%20regular%20lines%20or%20disconnecting%20connectors.%26nbsp%3B%20This%20increases%20the%20likelihood%20that%20the%20%E2%80%9Cproper%20shape%20arrangement%E2%80%9D%20according%20to%20the%20solution%20is%20not%20at%20all%20what%20the%20user%20intends.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CH3%20id%3D%22toc-hId-641703964%22%20id%3D%22toc-hId-810504605%22%3ERemedies%20for%20Automatic%20Solution%20Behaviors%3C%2FH3%3E%0A%20%20%3CP%3EThere%20are%20two%20basic%20approaches%20to%20correcting%20a%20diagram%20that%20is%20%E2%80%9Cmisbehaving%E2%80%9D.%26nbsp%3B%20You%20can%20try%20to%20make%20the%20solution%20understand%20the%20diagram%20again.%26nbsp%3B%20This%20typically%20involves%20removing%20non-standard%20shapes%20and%20using%20the%20ones%20provided%20in%20the%20template.%26nbsp%3B%20It%20also%20means%20restoring%20connections%20between%20shapes%20using%20connectors%20and%20not%20lines.%26nbsp%3B%20The%20other%20approach%20is%20to%20disable%20the%20%E2%80%9Cintelligent%E2%80%9D%20behavior%20of%20the%20solution%20and%20work%20with%20the%20diagram%20using%20core%20Visio%20capabilities%20only.%26nbsp%3B%20Depending%20on%20the%20drawing%20type%20and%20level%20of%20complexity%20in%20the%20diagram%20you%20may%20want%20the%20second%20option%2C%20although%20this%20is%20a%20more%20drastic%20measure.%3C%2FP%3E%0A%20%20%3CP%3EFor%20Organization%20Charts%2C%20the%20typical%20cleanup%20is%20to%20delete%20the%20connections%20between%20shapes%20and%20then%20drop%20each%20subordinate%20on%20top%20of%20their%20manager%20again.%26nbsp%3B%20For%20Cross-functional%20Flowcharts%2C%20the%20typical%20cleanup%20is%20to%20drag%20each%20process%20shape%20outside%20the%20swimlanes%20and%20then%20drag%20them%20back%20in.%26nbsp%3B%20Unfortunately%2C%20none%20of%20these%20remedies%20is%20guaranteed.%26nbsp%3B%20There%20may%20be%20no%20way%20for%20a%20user%20to%20correct%20some%20situations.%3C%2FP%3E%0A%20%20%3CP%3ETo%20disable%20a%20solution%2C%20you%20need%20to%20disable%20the%20Persisted%20Events%20that%20get%20stored%20in%20the%20document%20and%20trigger%20the%20solution%20whenever%20the%20document%20is%20opened%20in%20Visio.%26nbsp%3B%20Persisted%20Events%20can%20only%20be%20managed%20programmatically%20or%20through%20Visio%E2%80%99s%20XML%20file%20formats.%26nbsp%3B%20The%20Persisted%20Events%20tool%20in%20the%20Visio%20SDK%20is%20a%20great%20way%20to%20modify%20Persisted%20Events.%26nbsp%3B%20For%20those%20looking%20for%20something%20simpler%2C%20try%20pasting%20the%20VBA%20macros%20below%20into%20your%20document.%26nbsp%3B%20Run%20DisablePersistedEvents%20to%20turn%20off%20solution%20behavior%20for%20the%20document.%26nbsp%3B%20Run%20EnablePersistedEvents%20to%20turn%20solution%20behavior%20back%20on.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EPublic%20Sub%20DisablePersistedEvents()%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EDim%20vsoEvent%20As%20Visio.Event%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EFor%20Each%20vsoEvent%20In%20ThisDocument.EventList%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EIf%20vsoEvent.Persistent%20%3D%20True%20Then%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EvsoEvent.Enabled%20%3D%20False%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EEnd%20If%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3ENext%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EEnd%20Sub%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EPublic%20Sub%20EnablePersistedEvents()%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EDim%20vsoEvent%20As%20Visio.Event%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EFor%20Each%20vsoEvent%20In%20ThisDocument.EventList%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EIf%20vsoEvent.Persistent%20%3D%20True%20Then%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EvsoEvent.Enabled%20%3D%20True%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EEnd%20If%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3ENext%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EEnd%20Sub%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CH3%20id%3D%22toc-hId--1910452997%22%20id%3D%22toc-hId--1741652356%22%3EConclusion%3C%2FH3%3E%0A%20%20%3CP%3EVisio%20provides%20automatic%20behaviors%20to%20make%20diagrams%20much%20easier%20to%20create%20and%20manage.%26nbsp%3B%20When%20the%20automatic%20behavior%20matches%20your%20expectations%2C%20Visio%20feels%20like%20a%20very%20powerful%20tool.%26nbsp%3B%20When%20Visio%20seems%20to%20have%20a%20mind%20of%20its%20own%2C%20it%20becomes%20a%20frustrating%20application%20to%20work%20with.%26nbsp%3B%20The%20Visio%20Product%20Team%20is%20definitely%20interested%20in%20your%20experiences%20good%20or%20bad%20with%20the%20automatic%20behaviors%20in%20the%20application.%26nbsp%3B%20Your%20feedback%20helps%20us%20understand%20where%20we%20need%20to%20improve.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-237302%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Aug%2C%2024%202007%20Several%20people%20have%20posted%20in%20the%20newsgroups%20about%20Visio%20moving%20shapes%20around%20unexpectedly%20-%20particularly%20when%20documents%20are%20opened%20or%20saved.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-237302%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eall%20posts%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Egeneral%20usage%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
First published on MSDN on Aug, 24 2007

Several people have posted in the newsgroups about Visio moving shapes around unexpectedly - particularly when documents are opened or saved.  This random behavior can be infuriating to users.  Perhaps more frustrating is that Visio may continue moving shapes around after the user has "fixed up" their diagram again.  This post looks at automatic behaviors and tries to shine some light on the issues.

Connector Routing

Perhaps the most common automatic activity in Visio is connector routing.  Visio ensures that connectors stay glued to shapes when those shapes are moved around the page.  Visio also finds the optimum route for connectors that will avoid other shapes along the path.  Finally line jumps are added to connectors that cross over other connectors.  Historically, crazy connector routing has been a frequent complaint, but routing logic has gotten significantly better over time.  Recent versions of Visio do a pretty good job with routing.  While users may object to the routes chosen, there are very few reports of routes randomly changing in the diagram.


If you are encountering routing issues in your diagram, you might find this earlier post helpful.  You can also reduce the number of situations where connector routes are changed.  Go to Format > Behavior and then the Connector tab and adjust the Reroute property.  Reroute = Never means that Visio will maintain glue but never recompute the route to optimize it.

Solution Behaviors

The second type of automatic behaviors involve Visio solutions.  In this case we are referring to the Visio add-ons that provide extra capabilities for individual diagram types.  For example, the Organization Chart solution is responsible for providing features such as dropping subordinates on top of managers, generating a diagram using the Organization Chart Wizard or synchronizing organizations across pages.  You may not think of these capabilities as add-ons because Visio tries to make the functionality seem as integrated as possible with the core diagramming features.

Most frequently we hear about random shape movement with the Organizational Chart and Cross-functional diagram types.  However, users have reported issues with a number of diagrams such as Gantt Charts and Timelines too.  The root cause for random shape movement is that a diagram has solution managing the position of shapes, and something is triggering that solution to make it move shapes around the page.  These solutions get in trouble when they fail to realize that a shape’s current position has been designated by the user and is no longer under the complete control of the solution.

Visio’s solutions that manage the position of shapes on the page can tolerate varying degrees of customization by the user.  Sometimes it is okay for a shape to be in a different location than what the solution wants, and sometimes the solution is not capable of leaving a shape in a different location.  Many problems arise when the user takes additional steps to prevent automatic behavior such as grouping shapes, replacing connectors with regular lines or disconnecting connectors.  This increases the likelihood that the “proper shape arrangement” according to the solution is not at all what the user intends.

Remedies for Automatic Solution Behaviors

There are two basic approaches to correcting a diagram that is “misbehaving”.  You can try to make the solution understand the diagram again.  This typically involves removing non-standard shapes and using the ones provided in the template.  It also means restoring connections between shapes using connectors and not lines.  The other approach is to disable the “intelligent” behavior of the solution and work with the diagram using core Visio capabilities only.  Depending on the drawing type and level of complexity in the diagram you may want the second option, although this is a more drastic measure.

For Organization Charts, the typical cleanup is to delete the connections between shapes and then drop each subordinate on top of their manager again.  For Cross-functional Flowcharts, the typical cleanup is to drag each process shape outside the swimlanes and then drag them back in.  Unfortunately, none of these remedies is guaranteed.  There may be no way for a user to correct some situations.

To disable a solution, you need to disable the Persisted Events that get stored in the document and trigger the solution whenever the document is opened in Visio.  Persisted Events can only be managed programmatically or through Visio’s XML file formats.  The Persisted Events tool in the Visio SDK is a great way to modify Persisted Events.  For those looking for something simpler, try pasting the VBA macros below into your document.  Run DisablePersistedEvents to turn off solution behavior for the document.  Run EnablePersistedEvents to turn solution behavior back on.

Public Sub DisablePersistedEvents()

Dim vsoEvent As Visio.Event

For Each vsoEvent In ThisDocument.EventList

If vsoEvent.Persistent = True Then

vsoEvent.Enabled = False

End If

Next

End Sub

Public Sub EnablePersistedEvents()

Dim vsoEvent As Visio.Event

For Each vsoEvent In ThisDocument.EventList

If vsoEvent.Persistent = True Then

vsoEvent.Enabled = True

End If

Next

End Sub

Conclusion

Visio provides automatic behaviors to make diagrams much easier to create and manage.  When the automatic behavior matches your expectations, Visio feels like a very powerful tool.  When Visio seems to have a mind of its own, it becomes a frustrating application to work with.  The Visio Product Team is definitely interested in your experiences good or bad with the automatic behaviors in the application.  Your feedback helps us understand where we need to improve.