By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,872 Members | 679 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,872 IT Pros & Developers. It's quick & easy.

ASP VBScript ActiveX Can't create object error

P: 1
My company has implementd Vista with IE7 and office 2007. We also use Sharepoint extensively for team sites and division portals. I am in Sharepoint consultation/support.

One user just moved a website from our old system to sharepoint, and now one of her links is broken. It is a simple ASP page with parameters that uses VB script to create an Excel object and load an Excel file into it (wb name, sheet name, and scroll number are the ASP parameters). The asp and excel files reside on an NT share in the same place they alwasy have, and the link is exactly the same as before. This has worked in the past without a hitch. Now it doesn't work for anyone but her.
The url is .../xlscroll.asp?xlbook=EONsearchrev102907.xls&xlsheet =Tech%20Reports-IRs&scrollnum=1

The asp code is:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <script language="vbscript">
  4. on error resume next
  6.     xlbook = "<%=request.QueryString("xlbook")%>"
  7.     xlsheet = "<%=request.QueryString("xlsheet")%>"
  8.     scrollnum = "<%=request.QueryString("scrollnum")%>"
  10.     strPath =  "<%=Request.ServerVariables("PATH_INFO")%>"
  11.     strServer =  "<%=Request.ServerVariables("SERVER_NAME")%>"
  13.     strPath = lcase(replace(ucase(strPath), "XLSCROLL.ASP",""))
  14.     strPath = replace(strPath, "/", "\")
  15.     strPath = "\\" & strServer & strPath
  17.     set objExcel = createobject("Excel.Application")
  19. if err.number > 0 then
  20.     document.write err.description & "<br>"
  21. else
  22.     document.write "OK<br>"
  23. end if
  25.     set objWkbook = objExcel.Workbooks.Open(strpath & xlbook)
  26.     objExcel.Visible = true    
  28.     objWkbook.WorkSheets(xlsheet).activate
  29.     objExcel.Activewindow.scrollrow = scrollnum
  30.     objWkbook.WorkSheets(xlsheet).rows(scrollnum).Select
  32.     set objSheet = nothing
  33.     set objWkbook = nothing
  34.     set objExcel = nothing
  36. </script>
  38. <table>
  39. <tr><td><B> Request Processed</B></td></tr>
  40. <tr><td>
  41. <input type="button" value="BACK" onclick="self.history.go(-1)"> 
  42. </td></tr>
  43. </table>
  44. </body>
  45. </html>
I've added the 'on error' and 'if err.number ...' sections to see that the error description is 'ActiveX component can't create object', and the error occurs right after the CreateObject statement.

Also - I see Excel.exe show up in my tasklist for a moment, then it disappears right away. The Event Viewer shows an Information entry at that specific time, but all it says is that Excel started a session that lasted 0 seconds and the session ended normally.

Any ideas?

Aug 4 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 432
No promises but....

Expand|Select|Wrap|Line Numbers
  1. Set ExcelApp = CreateObject("Excel.Application")
  2. ExcelApp.Visible = True
  3. ExcelApp.Workbooks.Add
  4. ExcelApp.Workbooks(1).ActiveSheet.Name = "Worksheet_name" 'name the worksheet
  5. Set ExcelBook = ExcelApp.ActiveSheet
Also might greatly depend on how\where your testing this for permissions reasons, etc.
Aug 6 '08 #2

Expert 2.5K+
P: 3,405
Also might greatly depend on how\where your testing this for permissions reasons, etc.
that echoes my thoughts, especially when he said "Now it doesn't work for anyone but her."

Can you confirm that this still works for her? And if so, is she following the same link as everyone else?

Aug 6 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.