Setting a Visio Cell's Formula

As I have illustrated previously, to set a Cell object's Formula property, you use the standard Visual Basic assignment syntax. Here is an example of setting the Formula property of a Geometry1.X6 cell presuming that a Geometry1.X6 cell exists:

Dim shpObj As Visio.Shape
Dim celObj As Visio.Cell
Set shpObj = Visio.ActivePage.Shapes.Item(1)
Set celObj = shpObj.Cells("Geometry1.X6")
celObj.Formula = "=Geometry1.X1"

This example sets an intercell formula into the X6 cell to make it reference the X1 cell. The equals sign at the beginning of the formula is optional just as it is when working directly within the ShapeSheet environment.

You can also set the Result property to replace a formula with its result by using ...

Get Professional Development with Visio® 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.