- Dim objExcel,strArray(6)
- strPath=Left(WScript.ScriptFullName,InStrRev(WScript.ScriptFullName,"\"))
- Set objExcel=CreateObject("Excel.Application")
- objExcel.WorkBooks.Add()
- objExcel.DisplayAlerts=false
- objExcel.visible=true
- objExcel.SheetsInNewWorkBook=2
- col=1
- row=1
- strArray(0)="姓名"
- strArray(1)="数学"
- strArray(2)="外语"
- strArray(3)="历史"
- strArray(4)="化学"
- strArray(5)="生物"
- For col=1 to 6
- objExcel.Cells(1,col).value=strArray(col-1)
- Next
-
- For row=2 to 10
- objExcel.Cells(row,1).value=String(1,65)+CStr(row)
- Next
-
- objExcel.Range("B2:F10").Formula="=40+Int(Rand()*61)"
- objExcel.Range("A1:F10").Style.HorizontalAlignment=-4108
-
- Set objShape=objExcel.ActiveSheet.Shapes.AddChart(51)
- objShape.Chart.SetSourceData objExcel.Range("A1:F10"),2
- Set objShape=Nothing
-
- objExcel.ActiveSheet.SaveAs(strPath&"test.xlsx")
- Set objExcel=Nothing
- 'objExcel.Quit()
复制代码
|