Result 屬性 (Visio)Cell.Result property (Visio)

取得或設定儲存格值。Gets or sets a cell's value. 可讀寫。Read/write.

語法Syntax

運算式結果(UnitsNameOrCode)expression.Result (UnitsNameOrCode)

_運算式_代表**Cell** 物件的變數。expression A variable that represents a Cell object.

參數Parameters

名稱Name 必要/選用Required/Optional 資料類型Data type 描述Description
UnitsNameOrCodeUnitsNameOrCode 必要Required VariantVariant 在擷取或設定儲存格值時所使用的單位。The units to use when retrieving or setting the cell's value.

傳回值Return value

雙精度浮點數Double

備註Remarks

使用Result屬性來設定 unguarded 儲存格的值。Use the Result property to set the value of an unguarded cell. 如果儲存格的公式受到 GUARD 功能的保護,則公式不會變更,而會產生錯誤。If the cell's formula is protected with the GUARD function, the formula is not changed and an error is generated. 如果儲存格只包含文字字串,則會傳回零 (0)。If the cell contains only a text string, zero (0) is returned. 如果字串無效,則會產生錯誤。If the string is invalid, an error is generated.

您可以將_UnitsNameOrCode_指定為整數或字串值。You can specify UnitsNameOrCode as an integer or a string value. 例如,下列的陳述式全都會將 UnitsNameOrCode 設定為英吋。For example, the following statements all set UnitsNameOrCode to inches.

retVal = 儲存格。 Result (visInches)retVal = Cell.Result (visInches)

retVal = 儲存格。結果(65)retVal = Cell.Result (65)

retVal = 儲存格。 Result ("in"), 其中 "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".

如需有效單位字串以及相對應之 Automation 常數 (整數值) 的完整清單,請參閱關於度量單位For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About units of measure.

代表單位的自動化常數是由 Visio 類型程式庫中的 [成員**VisUnitCodes**] 所宣告。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. 若要指定隱含的單位, 您必須使用Formula屬性。To specify implicit units, you must use the Formula property.

範例Example

下列的 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

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.