共用方式為


XmlMappedRange.Value2 屬性 (2007 系統)

更新:2007 年 11 月

取得或設定 XmlMappedRange 控制項的值。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v9.0 (在 Microsoft.Office.Tools.Excel.v9.0.dll 中)

語法

<TypeConverterAttribute(GetType(StringConverter))> _
Public Property Value2 As Object

Dim instance As XmlMappedRange
Dim value As Object

value = instance.Value2

instance.Value2 = value
[TypeConverterAttribute(typeof(StringConverter))]
public Object Value2 { get; set; }

屬性值

型別:System.Object

XmlMappedRange 控制項的值。

備註

這個屬性和 Value 屬性之間的差異,是 Value2 不是參數型屬性。

範例

下列程式碼會比較 TextValue 屬性與包含格式化數字的儲存格之間的差異。此程式碼範例假設目前工作表包含名為 CustomerLastNameCell 的 XmlMappedRange

Private Sub CompareTextAndValue2()
    Me.CustomerAddress1Cell.Value2 = 1198.3
    Me.CustomerAddress1Cell.NumberFormat = "$#,##0"

    ' Displays "1198.3".
    MsgBox("The Value2 value is: " & Me.CustomerAddress1Cell.Value2.ToString())

    ' Displays "$1,198".
    MsgBox("The Text value is: " & Me.CustomerAddress1Cell.Text.ToString())
End Sub
private void CompareTextAndValue2()
{
    this.CustomerAddress1Cell.Value2 = 1198.3;
    this.CustomerAddress1Cell.NumberFormat = "$#,##0";

    // Displays "1198.3".
    MessageBox.Show("The Value2 value is: " + 
        this.CustomerAddress1Cell.Value2.ToString());

    // Displays "$1,198".
    MessageBox.Show("The Text value is: " +
        this.CustomerAddress1Cell.Text.ToString());
}

使用權限

請參閱

參考

XmlMappedRange 類別

XmlMappedRange 成員

Microsoft.Office.Tools.Excel 命名空間