---------------------------------------------------------------------------------------------------------
●·● 目录:
---------------------------------------------------------------------------------------------------------
Application 接口:Represents the entire Microsoft Excel application.【继承于:_Application 接口】
Workbook 接口:Represents a Microsoft Excel workbook.【继承于:_Workbook 接口】
Worksheet 接口:Represents a worksheet.【继承于:_Worksheet 接口】
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A1个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. Represents the entire Microsoft Excel application.
2. _Application 属性:
Application:基本上具有 _Application 的调用!
ActiveCell:Returns a Range object that represents the active cell in the active window (the window on top) or in the specified window. →返回当前选择的 Range 对象!
Excel.Range range =ex.ActiveCell; //赋值到一个 Range 对象
MessageBox.Show(range.Row.ToString()); //获取行号
MessageBox.Show(range.Column.ToString()); //获取列号
ActiveChart:Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet).
ActiveSheet:Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. →返回当前的工作表对象!
Excel.Worksheet sheet = ex.ActiveSheet;
ActiveWorkbook:Returns a Workbookobject that represents the workbook in the active window (the window on top). →返回当前的工作簿对象!
Excel.Workbook book = ex.ActiveWorkbook;
Caption:The name that appears in the title bar of the main Microsoft Excel window.
Cursor:Returns or sets the appearance of the mouse pointer in Microsoft Excel.【返回:XlMousePointer】→鼠标显示样式!
CutCopyMode:Returns or sets the status of Cut or Copy mode.【返回:XlCutCopyMode】→选择框是否保留!
Sheets:Returns a Sheets collection that represents all the sheets in the active workbook. →返回所有工作表!
ThisWorkbook:Returns a Workbook object that represents the workbook where the current macro code is running. →返回当前工作表!
Top:The distance, in points, from the top edge of the screen to the top edge of the main Microsoft Excel window.
Left:The distance, in points, from the left edge of the screen to the left edge of the main Microsoft Excel window.
Height:The height, in points, of the main application window.
Columns:Returns a Range object that represents all the columns on the active worksheet. →返回所有列
Rows:Returns a Range object that represents all the rows on the active worksheet. →返回所有行
Cells:Returns a Range object that represents all the cells on the active worksheet. →返回所有单元格
long count =ex.Cells.CountLarge; //用 Count 会出错!
MessageBox.Show(count.ToString()); //显示所有的单元格个数!
Visible:Determines whether the object is visible. →是否可见!
UserName:Returns or sets the name of the current user.
Value:Returns "Microsoft Excel".
Version:Determines whether the object is visible.
WindowState:Returns or sets the state of the window.【返回:XlWindowState】→最大化、最小化等!
Workbooks:Returns a Workbooks collection that represents all the open workbooks. →返回所有工作簿!
Worksheets:Returns a Sheets collection that represents all the worksheets in the active workbook. →返回所有工作表!
3. _Application 方法:
InputBox:Displays a dialog box for user input. Returns the information entered in the dialog box.
Quit:Quits Microsoft Excel.
---------------------------------------------------------------------------------------------------------
╔════════╗
╠════╣ 第A2个 ╠══════════════════════════════════════════════════╣
╚════════╝
1. A collection of all the Workbook objects that are currently open in the Microsoft Excel application.
2. Workbooks 属性:
Application:
Count:Returns the number of objects in the collection. Read-only Integer.
Item:Returns a single object from a collection.【类似数组的用法】
Parent:Returns the parent object for the specified object. Read-only.
3. Workbooks 方法:
Add:Creates a new workbook. The new workbook becomes the active workbook. Returns a Wor