Abs()

Syntax

Abs(n)

Remarks

Returns the absolute value of n. For example, Abs(-5) returns the value 5.

Example

This example toggles the display of hidden text. You can use this example as
a model for toggling any check box in Word. In a Word dialog box, a selected check box has a value of 1; a cleared check box has a value of 0 (zero). The example reverses the current value of the check box by subtracting 1 from it
and using Abs() to return the absolute value of the result.


Dim dlg As ToolsOptionsView
GetCurValues dlg
dlg.Hidden = Abs(dlg.Hidden - 1)
ToolsOptionsView dlg

See Also

Int(), Rnd(), Sgn()