Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding worksheets in Excel
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Adding worksheets in Excel
Miscellaneous
Thread ID:
00442625
Message ID:
00442625
Views:
49
By default adding a workbook creates three worksheets. I need to add 5
worksheets to this newly created Excel workbook.

By just adding a worksheet adds it before "Sheet1". I need to add five
after "Sheet3"

I'm using the Excel Visual Basic Reference help file (the .CHM one) and it
says that you can do this all on one line. The reference for the WorkSheets
Add method follows. The syntax is specific in that you can specify
whether to add the new worksheet before or after the current worksheet. You
can also specify how many. Everything I have tried does not work.

Any ideas how to get this to work?

Thanks,
John Gundrum

Add Method (Worksheets Collection)
Creates a new worksheet. The new worksheet becomes the active sheet. Returns
a Worksheet object.

Syntax
expression.Add(Before, After, Count, Type)

expression Required. An expression that returns a Worksheets object.

Before Optional Variant. An object that specifies the sheet before which
the new sheet is added.

After Optional Variant. An object that specifies the sheet after which the
new sheet is added.

Count Optional Variant. The number of sheets to be added. The default
value is one.

Type Optional Variant. The sheet type. Can be one of the following
XlSheetType constants: xlWorksheet, xlExcel4MacroSheet, or
xlExcel4IntlMacroSheet. The default value is xlWorksheet.

Remarks
If Before and After are both omitted, the new sheet is inserted before the
active sheet.
John Gundrum
Canon Technology Solutions Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform