SETATREFEXPR Function
TOC
Collapse the table of content
Expand the table of content

SETATREFEXPR Function

Office 2013 and later

Last modified: March 09, 2015

Applies to: Office 2013 | Visio 2013

In this article
Syntax
Remarks
Example 1
Example 2
Example 3

Stores a value that is set through an action in the user interface (UI) or Automation.

SETATREFEXPR ([expr_opt])

Parameters

Name

Required/Optional

Data Type

Description

expr_opt

Optional

Varies

An expression that is replaced by the value or expression being assigned to the referenced cell in the SETATREF function. If not indicated, its initial value is 0 (zero).

The value of a SETATREFEXPR expression can also be set from a SETATREF function in another cell that references the cell containing the SETATREFEXPR expression.

You are not limited to using the SETATREFEXPR function as a parameter to the SETATREF function.

The following example uses the SETATREFEXPR function to ensure that a shape is as wide as its text.

Width =MAX(TEXTWIDTH(TheText),SETATREFEXPR())

The following example shows how you can use the SETATREFEXPR function to cause your shapes to snap to a custom grid. The SETATREFEXPR formulas are placed in the PinX and PinY cells, causing the shape's pin to snap to the grid defined in User.GridX and User.GridY.

User.GridX =2 in

User.GridY =2 in

PinX =INT(SETATREFEXPR()/User.GridX + .5)*User.GridX

PinY =INT(SETATREFEXPR()/User.GridY + .5)*User.GridY

For an example using the SETATREFEXPR function with the SETATREF function, see the SETATREF function.

Show:
© 2016 Microsoft