Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.7.1
ASP/COM Platform

View Docs for Another
Version or Platform

Programmer's Reference > ExcelApplication > Objects > Worksheets

ExcelApplication is not
available in ExcelWriterSE.

The Worksheets Object (SAWorksheets)

Worksheets Methods and Properties

Worksheets Methods and Properties

Add

Adds a worksheet to your Excel application. To add second and third worksheets to an existing Excel application, use,

Signature:


[VBScript]
Function Add([SheetName As String]) As Integer

Example:



[VBScript]

xlw.Worksheets.Add
dim Worksheet2 
set Worksheet2 = xlw.Worksheets(2)
		
xlw.Worksheets.Add
dim Worksheet3 
set Worksheet3 = xlw.Worksheets(3)

Top

Count

Counts the number of worksheets in your Excel application (workbook).

Signature:


[VBScript]
Property Count As Integer (read-only)

Example:



[VBScript]

Dim SheetCount, XlwApp
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")

'--- Get the number of sheets in the workbook
SheetCount = XlwApp.Worksheets.Count

Top

Item

Represents a single worksheet in a Worksheet collection. Item is the default property of Worksheets, so Worksheets(1)  is equivalent to Worksheets.Item(1) . You can reference a Worksheets item either by number or by name.

Signature:


[VBScript]
In VBScript, this is the default property for the SAWorksheets object.

Property Item As SAWorksheet (read-only)

Example:



[VBScript]

Dim XlwApp, WrkSht
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")

'--- Get the first worksheet in the workbook
Set WrkSht = XlwApp.Worksheets(1)


Top

Remove

Removes a worksheet from the specified Excel workbook. Remove takes the worksheet's name or index number as a parameter.

Signature:


[VBScript]
Sub Remove(Sheet As Variant)

Example:



[VBScript]

Set oXLW = Server.CreateObject("SoftArtisans.ExcelWriter")
...
oXLW.Worksheets.Remove(2)

Top





Copyright 2006 © SoftArtisans, Inc. All Rights Reserved.