共用方式為


WorksheetBase.Select Method

Selects the worksheet.

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 Sub Select ( _
    replace As Object _
)
public void Select(
    Object replace
)

Parameters

  • replace
    Type: System.Object

    true to remove the current selection and select the worksheet instead; false to extend the current selection to include any previously selected objects and the worksheet.

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the Select method to select Sheet1, and then extends the selection to include Sheet2 and Sheet3.

This example is for a document-level customization.

Private Sub SelectWorksheets()
    Globals.Sheet1.Select(True)
    Globals.Sheet2.Select(False)
    Globals.Sheet3.Select(False)
End Sub
private void SelectWorksheets()
{
    Globals.Sheet1.Select(true);
    Globals.Sheet2.Select(false);
    Globals.Sheet3.Select(false);
}

.NET Framework Security

See Also

Reference

WorksheetBase Class

Microsoft.Office.Tools.Excel Namespace