GUARD Function

Office 2013 and later

Last modified: March 09, 2015

Applies to: Office 2013 | Visio 2013

In this article
Syntax
Remarks
Example

Protects expression from deletion and change by actions performed in the drawing window, for example, moving, sizing, grouping, or ungrouping shapes.

GUARD(expression)

Parameters

Name

Required/Optional

Data Type

Description

expression

Required

String

A combination of constants, operators, functions, and references to ShapeSheet cells that results in a value.

The cells most often affected by the GUARD function are Width, Height, PinX, and PinY.

Guarding a formula in any cell prevents that cell's value from being changed by actions in the drawing window. However, one action in the drawing window can affect several cells, and each of these cells must be guarded if you want to prevent unexpected changes to the shape's appearance.

GUARD(TEXTWIDTH(TheText) + 0.5 in)

This expression in the Width cell of a shape's Shape Transform section prevents the expression (TEXTWIDTH(TheText) + 0.5 in) from being replaced with another value when the shape's width is changed in the drawing window. TheText is a cell that gets triggered when the associated shape's text composition changes.

Show: