WorksheetBase.Evaluate Method

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

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

Syntax

'Declaration
Public Function Evaluate ( _
    name As Object _
) As Object
public Object Evaluate(
    Object name
)

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"].Value2 = 90;
    MessageBox.Show(this.Evaluate("SIN(A1)").ToString());
}

.NET Framework Security

See Also

Reference

WorksheetBase Class

Microsoft.Office.Tools.Excel Namespace