Cell.ResultStr Property
Visio Automation Reference |
Gets the value of a ShapeSheet cell expressed as a string. Read-only.
Version Information
Version Added: Visio 4.0
Syntax
expression.ResultStr(UnitsNameOrCode)
expression A variable that represents a Cell object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
UnitsNameOrCode | Required | Variant | The units to use when retrieving the value. |
Return Value
String
Remarks
Getting the ResultStr property is similar to getting a cell's Result property. The difference is that ResultStr property returns a string for the value of the cell, whereas the Result property returns a floating point number.
You can specify UnitsNameOrCode as an integer or a string value. If the string is invalid, an error is generated. For example, the following statements all set UnitsNameOrCode to inches.
stringReturned = Cell.ResultStr(visInches)
stringReturned = Cell.ResultStr(65)
stringReturned = Cell.ResultStr("in") where "in" can also be any of the alternate strings representing inches, such as "inch", "in.", or "intCounter".
For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About Units of Measure.
Automation constants for representing units are declared by the Visio type library in member VisUnitCodes.
Passing a zero (0) is sufficient for getting the value of text string cells.
You can use the ResultStr property to convert between units. For example, you can get the value in inches and then get an equivalent value in centimeters.
The ResultStr property is useful for filling controls such as edit boxes with the value of a cell.
Example
This Microsoft Visual Basic for Applications (VBA) macro shows two different ways to use the ResultStr property to get the value of a ShapeSheet cell that contains a shape's shape data (formerly Custom Properties).
To run this macro, open a blank drawing and the Computers and Monitors (US Units) stencil, and then insert a user form that contains a label, text box, and list box. Set the width of the list box to 150.
Note |
---|
The Computers and Monitors (US Units) stencil is available only in Microsoft Office Visio Professional. |
Visual Basic for Applications |
---|
|
See Also