Worksheet.Evaluate Method (2007 System)

Converts a Microsoft Office Excel name to an object or a value.

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

Syntax

'Declaration
Public Function Evaluate ( _
    Name As Object _
) As Object
'Usage
Dim instance As Worksheet 
Dim Name As Object 
Dim returnValue As Object 

returnValue = instance.Evaluate(Name)
public Object Evaluate(
    Object Name
)
public:
Object^ Evaluate(
    Object^ Name
)
public function Evaluate(
    Name : Object
) : Object

Parameters

  • Name
    Type: System.Object

    The name of the object, using the naming convention of Excel.

Return Value

Type: System.Object

Remarks

The following types of names in Excel can be used with this method:

  • Defined names. You can specify any name.

  • External references. You can use the ! operator to refer to a worksheet defined in another workbook.

Examples

The following code example uses the Evaluate method to evaluate the value of cell A1 as an input into the Excel SIN function.

This example is for a document-level customization.

Private Sub EvaluateSIN()
    Me.Range("A1").Value2 = 90
    MsgBox(Me.Evaluate("SIN(A1)").ToString())
End Sub
private void EvaluateSIN()
{
    this.Range["A1", missing].Value2 = 90;
    MessageBox.Show(this.Evaluate("SIN(A1)").ToString());
}

.NET Framework Security

See Also

Reference

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace