|
各位,小弟写了一个vbscript来开excel file, 可是有error,我弄了很久,还是弄不到,想请各位前辈帮帮忙!
我的OS是window vista
Error Message是 the server threw an exception.
code是:-
Option Explicit
Dim ad
Dim sql_query
Dim objFSO, objOutFile
Dim intCount, i
Dim objExcel,objSheet, intRow,strExcelPath
Set objExcel = CreateObject("Excel.Application")
If (Err.Number <> 0) Then
On Error GoTo 0
Wscript.Echo "Excel application not found."
Wscript.Quit
Else Wscript.Echo "Excel application found."
End If
On Error GoTo 0
strExcelPath = "C:\XXXX.xls"
objExcel.WorkBooks.open strExcelPath ' Where place the the error Hit
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit |
|