DefaultTextUnits property

Microsoft Visio Developer Reference

DefaultTextUnits property

   Example   

Determines the default unit of measure for quantities that represent text metrics.

Version added

2002

Syntax

unitsCode = object.DefaultTextUnits
object.DefaultTextUnits = unitsNameOrCode

unitsCode

Variant. The default text units.

object

Required. An expression that returns an Application object.

unitsNameOrCode

Required Variant. New default text units.

Remarks

The DefaultTextUnits property corresponds to the value shown in the Text box on the Regional tab in the Options dialog box (on the Tools menu, click Options).

The return value unitsCode contains one of the values of VisUnitCodes, which are declared in the Visio type library.

You can specify unitsNameOrCode as an integer (a member of VisUnitCodes) or a string value such as "pt". If the string is invalid or the unit code is inappropriate (non-textual), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About units of measure.

Cell formulas that contain a specific unit of measure are displayed in those units regardless of the default text units setting. Many cell formulas, however, use implicit unit syntax and are displayed in default units.

A program can create a cell whose formula is displayed in default units by setting the cell's Formula property to a string in implicit unit syntax. For example, the formula "=8[pt,T]" displays as "8 pt" if the DefaultTextUnits property is visPoints, and "0.6272" if the DefaultTextUnits property is visCiceros.

Alternatively, a program can set the cell's result to default text units using the following statement:

cellObj.Result(visTextUnits) = 12 

In this case, the text is 12 points if the DefaultTextUnits property is visPoints, and 12 ciceros if the DefaultTextUnits property is visCiceros.

For details about implicit units of measure, see About units of measure.