ShapeSheet cell reference error when using Shape.SetFormulas in Visio

193 views Asked by At

When I try to use .SetFormulas to reference Connector shapes on different page, I keep getting the #Name? error. The error would occur in both Visio 2010 and 2016. The code below works for circles and grouped shapes but not my connectors.

Dim formArray as String() = BuildFormulaArray(PreviousPageShapeIDs)
Dim theStream as Short() = StreamBuilder(CurrentShapeIDs, CustPropSection, Row, Cell)
Dim objArray as Object() = formArray.ConverToObject 'convenience function to convert each item to an object 

vPage.SetFormulas(theStream, objArray, VisGetSetArgs.visSetBlasGuards)

However, the code below works with the connectors

For i = 0 to formArray.GetUpperBounds(0)
Dim streamInd as Integer = 4*i
vPage.Shapes(theStream(streamInd)).CellsSRC(theStream(streamInd+1),theStream(streamInd+2),theStream(streamInd+3)).FormulaForce = formArray(i)
Next

My formula is referencing cells using the Pages[PageName]!Sheet.ShapeID!CellName method.

I know I can make this work by using CellsSRC or using the shape name in my formula, but I would rather stick with using SetFormulas and shape IDs for speed reasons. Any ideas on why Visio is behaving inconsistently?

0

There are 0 answers