DeferRecalc property

Microsoft Visio Developer Reference

DeferRecalc property

   Example   

Determines whether the application recalculates cell formulas during a series of actions.

Version added

4.1

Syntax

intRet = object.DeferRecalc
object.DeferRecalc = intExpression

intRet

Integer. False (0) if formulas are recalculated as needed; True (-1) if recalculation is deferred.

object

Required. An expression that returns an Application object.

intExpression

Required Integer. False (0) to recalculate formulas as needed; True (non-zero) to defer recalculation.

Remarks

Use the DeferRecalc property to improve performance during a series of actions. For example, you can defer formula recalculation while changing the formulas or values of several cells.

If a program neglects to turn recalculation on again after turning it off, Visio turns it on when the user performs an operation.

If you release objects or send a large number of commands to Visio while recalculation is deferred, Visio may at times need to process its queue of pending recalculations. Because of this, use care in setting formulas inside a scope where you want recalculation deferred. Ideally, you should only set formulas when recalculation is turned off.

For example, consider the following Microsoft Visual Basic sequence:

visObj.DeferRecalc = True
shpObj.Cells("height").ResultIU = 12
shpObj.Cells("width").ResultIU = 14
visObj.DeferRecalc = False

Because Visual Basic makes and releases a temporary Cell object in the preceding code, Visio will process its queue at that point.

In the following sequence, Visio will not process the recalculation queue until the program turns recalculation on again (or the user performs some operation).

visObj.DeferRecalc = True
Set cellObj1 = shpObj.Cells("Height")
Set cellObj2 = shpObj.Cells("Width")
cellObj1.ResultIU = 12
cellObj1.ResultIU = 14
visObj.DeferRecalc = False