Table of contents

Cell.Result 属性 (Visio)Cell.Result Property (Visio)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

获取或设置单元格的值。读/写。Gets or sets a cell's value. Read/write.


表达式结果( UnitsNameOrCode )expression . Result( UnitsNameOrCode )

表达式_一个表示单元格对象的变量。_expression A variable that represents a Cell object.


名称Name必需/可选Required/Optional数据类型Data Type说明Description
UnitsNameOrCodeUnitsNameOrCode必需RequiredVariantVariant检索或设置单元格的值时使用的单位。The units to use when retrieving or setting the cell's value.

返回值Return Value



结果属性用于设置未受保护的单元格的值。如果单元格的公式受 GUARD 函数保护,该公式不会更改并且会生成一个错误。如果该单元格包含文本字符串,则返回零 (0)。如果字符串无效,则会生成错误。Use the Result property to set the value of an unguarded cell. If the cell's formula is protected with the GUARD function, the formula is not changed and an error is generated. If the cell contains only a text string, zero (0) is returned. If the string is invalid, an error is generated.

您可以为整数或字符串值指定_UnitsNameOrCode_ 。例如,以下语句所有_UnitsNameOrCode_都设置为英寸。You can specify UnitsNameOrCode as an integer or a string value. For example, the following statements all set UnitsNameOrCode to inches.

retVal = Cell.Result (如厘米、 米)retVal = Cell.Result ( visInches )

retVal = Cell.Result (65)retVal = Cell.Result (65)

retVal = Cell.Result ("in") 在何处"in"也可以是任何替换字符串表示英寸之间,如"英寸"、"单元"或"intCounter"。retVal = Cell.Result ("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.

自动常量来表示单位都由成员VisUnitCodes中的 Visio 类型库声明。Automation constants for representing units are declared by the Visio type library in member VisUnitCodes .

若要指定内部单位,传递零长度字符串 ("")。内部单位是英寸的距离和角度的弧度。若要指定隐式单位,必须使用公式属性。To specify internal units, pass a zero-length string (""). Internal units are inches for distance and radians for angles. To specify implicit units, you must use the Formula property.


此 Microsoft Visual Basic for Applications (VBA) 宏显示如何使用Result属性。This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Result property.

Public Sub Result_Example() 

 Dim vsoShape As Visio.Shape 
 Dim vsoCell As Visio.Cell 
 Dim intLocalCenterX As Double 

 'Draw a rectangle. 
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1) 

 Set vsoCell = vsoShape.Cells("LocPinX") 
 intLocalCenterX = vsoCell.Result("cm") 
 Debug.Print intLocalCenterX 

 'You can also use the constants defined by the Visio type library. 
 intLocalCenterX = vsoCell.Result(visInches) 
 Debug.Print intLocalCenterX 

End Sub
© 2018 Microsoft