編輯

共用方式為


_Worksheet Interface

Definition

This is a primary interface in a COM coclass that is required by managed code for interoperability with the corresponding COM object. Use this primary interface only when the method you want to use shares the same name as an event of the COM object; in this case, cast to this interface to call the method, and cast to the latest events interface to connect to the event. Otherwise, use the .NET interface that is derived from the COM coclass to access methods, properties, and events of the COM object. For more information about the COM object, see Worksheet.

public interface class _Worksheet
[System.Runtime.InteropServices.Guid("000208D8-0000-0000-C000-000000000046")]
public interface _Worksheet
Public Interface _Worksheet
Derived
Attributes

Properties

_CodeName

Reserved for internal use.

_DisplayRightToLeft

Reserved for internal use.

Application

When used without an object qualifier, this property returns an Application object that represents the Microsoft Excel application. When used with an object qualifier, this property returns an Application object that represents the creator of the specified object (you can use this property with an OLE Automation object to return the application of that object). Read-only.

AutoFilter

Returns an AutoFilter object if filtering is on. Returns Nothing if filtering is off. Read-only.

AutoFilterMode

True if the AutoFilter drop-down arrows are currently displayed on the sheet. This property is independent of the FilterMode property. Read/write Boolean.

Cells

Returns a Range object that represents all the cells on the worksheet (not just the cells that are currently in use). Read-only.

CircularReference

Returns a Range object that represents the range containing the first circular reference on the sheet, or returns Nothing if there's no circular reference on the sheet. The circular reference must be removed before calculation can proceed. Read-only.

CodeName

Returns the code name for the object. Read-only String.

Columns

Returns a Range object that represents all the columns on the specified worksheet. Read-only.

Comments

Returns a Comments collection that represents all the comments for the specified worksheet. Read-only.

ConsolidationFunction

Returns the function code used for the current consolidation. Can be one of the XlConsolidationFunction constants. Read-only.

ConsolidationOptions

Returns a three-element array of consolidation options, as shown in the following table. If the element is True, that option is set. Read-only Object.

ConsolidationSources

Returns an array of string values that name the source sheets for the worksheet's current consolidation. Returns Empty if there's no consolidation on the sheet. Read-only Object.

Creator

Returns a constant in the XlCreator enumeration that indicates the application in which this object was created. If the object was created in Microsoft Excel, this property returns the string XCEL, which is equivalent to the hexadecimal number 5843454C. Read-only xlCreatorCode.

CustomProperties

Returns a CustomProperties object representing the identifier information associated with a worksheet.

DisplayAutomaticPageBreaks

Reserved for internal use.

DisplayPageBreaks

True if page breaks (both automatic and manual) on the specified worksheet are displayed. Read/write Boolean.

DisplayRightToLeft

True if the specified window, worksheet, or ListObject is displayed from right to left instead of from left to right. False if the object is displayed from left to right. Read-only Boolean.

EnableAutoFilter

True if AutoFilter arrows are enabled when user-interface-only protection is turned on. Read/write Boolean.

EnableCalculation

True if Microsoft Excel automatically recalculates the worksheet when necessary. False if Excel doesn't recalculate the sheet. Read/write Boolean.

EnableFormatConditionsCalculation

Returns or sets if conditional formats will occur automatically as needed. Read/write Boolean.

EnableOutlining

True if outlining symbols are enabled when user-interface-only protection is turned on. Read/write Boolean.

EnablePivotTable

True if PivotTable controls and actions are enabled when user-interface-only protection is turned on. Read/write Boolean.

EnableSelection

Returns or sets what can be selected on the sheet. Read/write XlEnableSelection.

FilterMode

True if the worksheet is in filter mode. Read-only Boolean.

HPageBreaks

Returns an HPageBreaks collection that represents the horizontal page breaks on the sheet. Read-only.

Hyperlinks

Returns a Hyperlinks collection that represents the hyperlinks for the range or worksheet.

Index

Returns the index number of the object within the collection of similar objects. Read-only Integer.

ListObjects

Returns a collection of ListObject objects in the worksheet. Read-only ListObjects collection.

MailEnvelope

Represents an e-mail header for a document.

Name

Returns or sets the name of the object. Read/write String.

Names

Returns a Names collection that represents all the worksheet-specific names (names defined with the "WorksheetName!" prefix). Read-only Names object.

Next

Returns a Chart, Range, or Worksheet object that represents the next sheet or cell. Read-only.

OnCalculate

Reserved for internal use.

OnData

Reserved for internal use.

OnDoubleClick

Reserved for internal use.

OnEntry

Reserved for internal use.

OnSheetActivate

Reserved for internal use.

OnSheetDeactivate

Reserved for internal use.

Outline

Returns an Outline object that represents the outline for the specified worksheet. Read-only.

PageSetup

Returns a PageSetup object that contains all the page setup settings for the specified object. Read-only.

Parent

Returns the parent object for the specified object. Read-only.

Previous

Returns a Chart, Range, or Worksheet object that represents the previous sheet or cell. Read-only.

PrintedCommentPages

Gets the number of comment pages that will be printed for the current worksheet.

ProtectContents

True if the contents of the sheet are protected. For a chart, this protects the entire chart. For a worksheet, this protects the individual cells. Read-only Boolean.

ProtectDrawingObjects

True if shapes are protected. Read-only Boolean.

Protection

Returns a Protection object that represents the protection options of the worksheet.

ProtectionMode

True if user-interface-only protection is turned on. To turn on user interface protection, use the Protect(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) method with the UserInterfaceOnly argument set to True. Read-only Boolean.

ProtectScenarios

True if the worksheet scenarios are protected. Read-only Boolean.

QueryTables

Returns the QueryTables collection that represents all the query tables on the specified worksheet. Read-only.

Range[Object, Object]

Returns a Range object that represents a cell or a range of cells.

Rows

Returns a Range object that represents all the rows on the specified worksheet. Read-only Range object.

Scripts

Returns the Scripts collection, which contains Script objects representing blocks of script or code in the specified document when it’s saved as a Web page.

ScrollArea

Returns or sets the range where scrolling is allowed as an A1-style range reference. Cells outside the scroll area cannot be selected. Read/write String.

Shapes

Returns a Shapes object that represents all the shapes on the worksheet or chart sheet. Read-only.

SmartTags

Returns a SmartTags object representing the identifier for the specified cell.

Sort

Returns the sorted values in the current worksheet. Read-only.

StandardHeight

Returns the standard (default) height of all the rows in the worksheet in points. Read-only Double.

StandardWidth

Returns or sets the standard (default) width of all the columns in the worksheet. Read/write Double.

Tab

Returns a Tab object for a chart or a worksheet.

TransitionExpEval

True if Microsoft Excel uses Lotus 1-2-3 expression evaluation rules for the worksheet. Read/write Boolean.

TransitionFormEntry

True if Microsoft Excel uses Lotus 1-2-3 formula entry rules for the worksheet. Read/write Boolean.

Type

Returns or sets the worksheet type. Read-only XlSheetType.

UsedRange

Returns a Range object that represents the used range on the specified worksheet. Read-only.

Visible

Determines whether the object is visible. Read/write XlSheetVisibility.

VPageBreaks

Returns a VPageBreaks collection that represents the vertical page breaks on the sheet. Read-only.

Methods

_CheckSpelling(Object, Object, Object, Object, Object, Object)

Reserved for internal use.

_Evaluate(Object)

Reserved for internal use.

_PasteSpecial(Object, Object, Object, Object, Object, Object)

Reserved for internal use.

_PrintOut(Object, Object, Object, Object, Object, Object, Object)

Reserved for internal use.

_Protect(Object, Object, Object, Object, Object)

Reserved for internal use.

_SaveAs(String, Object, Object, Object, Object, Object, Object, Object, Object)

Reserved for internal use.

Activate()

Makes the current sheet the active sheet. Equivalent to clicking the sheet's tab.

Arcs(Object)

Reserved for internal use.

Buttons(Object)

Reserved for internal use.

Calculate()

Calculates all open workbooks, a specific worksheet in a workbook, or a specified range of cells on a worksheet, as shown in the following table.

ChartObjects(Object)

Returns an object that represents either a single embedded chart (a ChartObject object) or a collection of all the embedded charts (a ChartObjects object) on the sheet.

CheckBoxes(Object)

Reserved for internal use.

CheckSpelling(Object, Object, Object, Object)

Checks the spelling of an object. This form has no return value; Microsoft Excel displays the Spelling dialog box.

CircleInvalid()

Circles invalid entries on the worksheet.

ClearArrows()

Clears the tracer arrows from the worksheet. Tracer arrows are added by using the auditing feature.

ClearCircles()

Clears circles from invalid entries on the worksheet.

Copy(Object, Object)

Copies the sheet to another location in the workbook.

Delete()

Deletes the object.

DrawingObjects(Object)

Reserved for internal use.

Drawings(Object)

Reserved for internal use.

DropDowns(Object)

Reserved for internal use.

Evaluate(Object)

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

ExportAsFixedFormat(XlFixedFormatType, Object, Object, Object, Object, Object, Object, Object, Object)

Exports to a file of the specified format.

GroupBoxes(Object)

Reserved for internal use.

GroupObjects(Object)

Reserved for internal use.

Labels(Object)

Reserved for internal use.

Lines(Object)

Reserved for internal use.

ListBoxes(Object)

Reserved for internal use.

Move(Object, Object)

Moves the sheet to another location in the workbook

OLEObjects(Object)

Returns an object that represents either a single OLE object (an OLEObject) or a collection of all OLE objects (an OLEObjects collection) on the chart or sheet. Read-only.

OptionButtons(Object)

Reserved for internal use.

Ovals(Object)

Reserved for internal use.

Paste(Object, Object)

Pastes the contents of the Clipboard onto the sheet.

PasteSpecial(Object, Object, Object, Object, Object, Object, Object)

Pastes the contents of the Clipboard onto the sheet using a specified format. Use this method to paste data from other applications or to paste data in a specific format.

Pictures(Object)

Reserved for internal use.

PivotTables(Object)

Returns an object that represents either a single PivotTable report (a PivotTable object) or a collection of all the PivotTable reports (a PivotTables object) on a worksheet. Read-only.

PivotTableWizard(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Creates a PivotTable object. This method doesn’t display the PivotTable Wizard. This method isn’t available for OLE DB data sources. Use the Add(Object, Object, Object, Object) method to add a PivotTable cache, and then create a PivotTable report based on the cache. PivotTable object.

PrintOut(Object, Object, Object, Object, Object, Object, Object, Object)

Prints the object.

PrintOutEx(Object, Object, Object, Object, Object, Object, Object, Object, Object)

Reserved for internal use.

PrintPreview(Object)

Shows a preview of the object as it would look when printed.

Protect(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Protects a worksheet so that it cannot be modified.

Rectangles(Object)

Reserved for internal use.

ResetAllPageBreaks()

Resets all page breaks on the specified worksheet.

SaveAs(String, Object, Object, Object, Object, Object, Object, Object, Object, Object)

Saves changes to the chart or worksheet in a different file.

Scenarios(Object)

Returns an object that represents either a single scenario (a Scenario object) or a collection of scenarios (a Scenarios object) on the worksheet.

ScrollBars(Object)

Reserved for internal use.

Select(Object)

Selects the object.

SetBackgroundPicture(String)

Sets the background graphic for a worksheet or chart.

ShowAllData()

Makes all rows of the currently filtered list visible. If AutoFilter is in use, this method changes the arrows to "All."

ShowDataForm()

Displays the data form associated with the worksheet.

Spinners(Object)

Reserved for internal use.

TextBoxes(Object)

Reserved for internal use.

Unprotect(Object)

Removes protection from a sheet or workbook. This method has no effect if the sheet or workbook isn't protected.

XmlDataQuery(String, Object, Object)

Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet or if the mapped range is empty.

XmlMapQuery(String, Object, Object)

Returns a Range object that represents the cells mapped to a particular XPath. Returns Nothing if the specified XPath has not been mapped to the worksheet.

Applies to