Guys,

I need to log centrally some file monitorings from different Servers therefore need to add tons of worksheets to my workbook.

well, the default behavior is to add BEFORE the active sheet (simply stunning [Mad] ).
Allthough I found a help topic :

quote:
expression.Add(Before, After, Count, Type)
After Optional Variant. An object that specifies the sheet after which the new sheet is added.

I failed to get that straight [Embarrassed]

here a sample of how I don't what it to work :


break on

$file = @scriptdir + '\test.xls'
if exist($file)
del $file
endif

$xl = createobject ( "excel.application" )
$ = $xl.workbooks.add

for $i = 1 to 7
if $i > 3
$ = $xl.worksheets.add ;<--- this needs to be corrected
endif
$ = $xl.WorkSheets("Sheet"+$i).Activate
$xl.ActiveSheet.name = "A" + $i
$xl.range("C3").value = "writetosheet$i"
next

$ = $xl.ActiveWorkbook.SaveAs($file)
$xl.UserControl = 1
$ = $xl.quit


[ 11. September 2003, 14:32: Message edited by: Jochen ]
_________________________