Worksheets.Add 方法 (Excel)Worksheets.Add method (Excel)

创建新的工作表、图表或宏工作表。Creates a new worksheet, chart, or macro sheet. 新工作表成为活动工作表。The new worksheet becomes the active sheet.

语法Syntax

表达式(之前之后计数类型)expression.Add (Before, After, Count, Type)

_表达式_一个代表**工作表** 对象的变量。expression A variable that represents a Worksheets object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
BeforeBefore 可选Optional VariantVariant 指定工作表的对象,新建的工作表将置于此工作表之前。An object that specifies the sheet before which the new sheet is added.
AfterAfter 可选Optional VariantVariant 指定工作表的对象,新建的工作表将置于此工作表之后。An object that specifies the sheet after which the new sheet is added.
CountCount 可选Optional VariantVariant 要添加的工作表数。The number of sheets to be added. 默认值为 1。The default value is one.
TypeType 可选Optional VariantVariant 指定工作表类型。Specifies the sheet type. 可以是下列的**XlSheetType** 常量之一: xlWorksheetxlChartxlExcel4MacroSheetxlExcel4IntlMacroSheetCan be one of the following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. 如果要基于现有模板插入工作表,请指定模板的路径。If you are inserting a sheet based on an existing template, specify the path to the template. 默认值为 xlWorksheetThe default value is xlWorksheet.

返回值Return value

表示新工作表、图表或宏工作表的 Object 值。An Object value that represents the new worksheet, chart, or macro sheet.

备注Remarks

如果同时省略 BeforeAfter,则新工作表插入到活动工作表之前。If Before and After are both omitted, the new sheet is inserted before the active sheet.

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.