XmlMappedRange.Formula Property (2007 System)

Gets or sets the formula of an XmlMappedRange control in A1-style notation.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property Formula As Object
'Usage
Dim instance As XmlMappedRange 
Dim value As Object 

value = instance.Formula

instance.Formula = value
[BrowsableAttribute(false)]
public Object Formula { get; set; }
[BrowsableAttribute(false)]
public:
property Object^ Formula {
    Object^ get ();
    void set (Object^ value);
}
public function get Formula () : Object 
public function set Formula (value : Object)

Property Value

Type: System.Object
The formula of an XmlMappedRange control in A1-style notation.

Remarks

If the XmlMappedRange control contains a constant, this property returns the constant.

If the XmlMappedRange control is empty, this property returns an empty string.

If the XmlMappedRange control contains a formula, this property returns the formula as a string in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of an XmlMappedRange control to a date, Microsoft Office Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, Excel changes the number format to the default short date number format.

Examples

The following code example uses the Formula property to set the value of an XmlMappedRange to equal the sum of the values of cells A1 and A2. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerAddress1Cell with a corresponding schema element of type int.

Private Sub SetFormula()
    Me.Range("A1", "A2").Value2 = 2222
    Me.CustomerAddress1Cell.Formula = "=Sum(A1+A2)" 
End Sub
private void SetFormula()
{
    this.Range["A1", "A2"].Value2 = 2222;
    this.CustomerAddress1Cell.Formula = "=Sum(A1+A2)";
}

.NET Framework Security

See Also

Reference

XmlMappedRange Class

XmlMappedRange Members

Microsoft.Office.Tools.Excel Namespace