I am currently working on an .asp application that manipulates
Excel from a web page using VBScript. The application
works fine on an NT platform, but it needs to be modified to
work under Windows XP. I am having problems with the section
of code described below. Here is what is happening:
When the code snippet above executes, a messagebox pops up
with the following error: "Error number 1004: Unable to
get the Open property of the Workbooks class." Ok, here is
where it gets crazy. If I put a STOP statement after the
"On Error Resume Next", and step through the code in "debug"
mode (using Visual InterDev), everything works fine. Does
anyone have any suggestions as to how to make it work WITHOUT the STOP statement? Any suggestions would be greatly appreciated.
Excel from a web page using VBScript. The application
works fine on an NT platform, but it needs to be modified to
work under Windows XP. I am having problems with the section
of code described below. Here is what is happening:
Code:
'======================================
' I define the variable globally first
'======================================
Dim xlobject ' Defined globally
Set xlobject = GetObject(,"excel.application")
'=================================================
' The code snippet listed below is where the
' problem occurs.
' CS_sSpreadsheetPath & sMasterWorkbookFileName
' form a fully qualified path to an existing .xls
' file.
'=================================================
On Error Resume Next
Dim xlMasterWorkbook
set xlMasterWorkbook = xlobject.workbooks.open(CS_sSpreadsheetPath & sMasterWorkbookFileName)
if err.number <> 0 then
msgbox "Error number " & err.number & ": " & err.description
err.clear
exit sub
end if
'=======================
' End of code snippet
'=======================
When the code snippet above executes, a messagebox pops up
with the following error: "Error number 1004: Unable to
get the Open property of the Workbooks class." Ok, here is
where it gets crazy. If I put a STOP statement after the
"On Error Resume Next", and step through the code in "debug"
mode (using Visual InterDev), everything works fine. Does
anyone have any suggestions as to how to make it work WITHOUT the STOP statement? Any suggestions would be greatly appreciated.