'Call AddSheet()
Function AddSheet ()
Environment.Value("FolderPath") = "C:\Documents and Settings\" & Environment.Value("UserName") & "\Desktop\EventIdNew2.xls"
Dim ExcelObj
Set ExcelObj = CreateObject("Excel.Application")
FilePath= Environment.Value("FolderPath")
'Disable alerts
ExcelObj.DisplayAlerts = False
Set ExcelWB =ExcelObj.Workbooks.Add
'Add a workbook to the Excel App
For i=1 to 4
ExcelWB.WorkSheets.Add
Next
'Save the file
ExcelObj.ActiveWorkbook.saveas FilePath
'Close Excel
ExcelObj.quit
'Relese the Object
Set ExcelWB = Nothing
Set ExcelObj = Nothing
End Function
No comments:
Post a Comment