Compartir a través de


WorksheetBase.Evaluate(Object) Method

Definition

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

public:
 System::Object ^ Evaluate(System::Object ^ name);
public object Evaluate (object name);
member this.Evaluate : obj -> obj
Public Function Evaluate (name As Object) As Object

Parameters

name
Object

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

Returns

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 void EvaluateSIN()
{
    this.Range["A1"].Value2 = 90;
    MessageBox.Show(this.Evaluate("SIN(A1)").ToString());
}
Private Sub EvaluateSIN()
    Me.Range("A1").Value2 = 90
    MsgBox(Me.Evaluate("SIN(A1)").ToString())
End Sub

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.

Applies to