
Creating and Saving Excel Sheets
In my script I am using the following code:
-----------------------------------------------------------
Const OutDir = "c:\temp\"
Const ExcelFile = "Excelfile.xls"
Const xlWBATWorksheet = -4167
Dim fso ' Filesystem Variable
Dim objXL, objWb, objWs ' Excel-Objektvariable
Set objXL = WScript.CreateObject("Excel.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWb = objXl.Workbooks
objWb.Add (xlWBATWorksheet)
Set objWs = objXL.ActiveWorkBook.WorkSheets(1)
objWs.Name = "test"
objXl.Save OutDir & ExcelFile
objWb.Close
objXl.Quit
Set objXL = Nothing
-----------------------------------------------------------
My problem is now, that the script seems to create to spreadsheets.
One is saved in the proper place and than I will be ask for a second
filename. Both files are looking identical, both files have a sheet called
"Test". If I am opening the Excelfile.xls the spreadsheet has the name
tabelle1.xls. What's wrong with my script ?
Axel