Developer Behavior Change in Visio 2007: Additional “GUARD” functions in Shapes

Some developers have noticed a change that we made in Visio 2007: more of the shapes we ship with Visio contain the GUARD ShapeSheet function. This was done to make some shapes work better with our new Themes feature and often just to take formatting more effectively in the first place. Here is an example of a networking shape colored red in Visio 2003 and in Visio 2007:

You can probably see why we thought that this was an important change to make. On the other hand, this newfound reliance on GUARD can cause problems for developers who expect that formula changes they make programmatically just work. With the new shapes (or any ShapeSheet cell containing a GUARD function), trying to set a guarded formula using FormulaU (note that we strongly recommend that you use FormulaU rather than Formula) will raise an exception. If the solution does not handle the exception properly (86db0528: "Cell is guarded.") it can crash or end up in an inconsistent state.

There are several ways to deal with this issue. The first is to change your code to simply handle the exception and take no further action. This will mean that the behavior that you get will be what the shape designer intended.

Another way is to change your uses of FormulaU that might run into this problem to FormulaForceU. This will essentially ignore the GUARD in the cell and set the cell to the specified value. This is not ideal (since those GUARDs are there for a reason) but will get around any possible exceptions.

If you don't have access to the source of the solution (or don't want to have to deploy a new version) we have created a new registry key to change the behavior of all existing uses of FormulaU to FormulaForceU (or Formula to FormulaForce). The key to use is:

  • HKEY_CURRENT_USER/Software/Microsoft/Office/12.0/Visio/Application/OverrideGuardedFormulas

We don't recommend this as a longer term solution, but it should work well for existing solutions that are hitting this problem.

Comments (2)

  1. I spent a little time today answering questions about some of the new features in Visio 2007, and noticed

  2. Padma says:

    I am using Visio Standard 2003 SP1 (11.4301.8132)

    I am trying to set a custom property via code using

    Application.ActiveDocument.Pages(1).PageSheet.Cells("Prop.FromPySes").FormulaForceU = "Some text"

    It is throwing an error -2032466907 (86db0425). I tried the Formula, FormulaU.

    I addded this FormulaForceU to registry entry. Still the same. Please advise,


Skip to main content