Solved

CreateObject("Excel.Application") fails after upgrading Excel on server from 97 to 2003

Posted on 2008-10-28
15
2,777 Views
Last Modified: 2012-08-13
This server side VB script
Set objExcel = CreateObject("Excel.Application")  '  Create an Excel object.
            objExcel.Application.Visible = true
            objExcel.Application.UserControl = true
fails with error
ActiveX component can't create object: 'Excel.Application'

after upgrading Office from 97 to 2003 on the server.  

App is opening Excel on server, generating file, saving it, and then emailing it to user.  After reading it appears it could be a permission issue for the account generating the excel process????

Thanks!
0
Comment
Question by:okcuser
  • 7
  • 6
  • 2
15 Comments
 

Author Comment

by:okcuser
ID: 22821368
When I run the page - I can look on the server and see the Excel.exe process created with my user account (I'm running from my desktop).  It will sit for a few minutes and then come back with the ActiveX component can't create object: 'Excel.Application' error.  Then the Excel.exe process is gone.
0
 
LVL 7

Expert Comment

by:Norush
ID: 22822131
Try with:
			Set objExcel = Server.CreateObject("Excel.Application")  '  Create an Excel object.

            objExcel.Application.Visible = true

            objExcel.Application.UserControl = true

Open in new window

0
 

Author Comment

by:okcuser
ID: 22823993
Thanks, but I already tried that and got this error:

Server.CreateObject Failed

Any other ideas?
0
 
LVL 7

Expert Comment

by:Norush
ID: 22824121
Can you show the entire errormessage you are getting when using my code ?
0
 
LVL 18

Expert Comment

by:exx1976
ID: 22825062
+1, I use Excel 2003 for all my automation routines, here's the code I use to get it rolling..


Set oExcelApp = CreateObject("Excel.Application")

Set oWorkbook = oExcelApp.Workbooks.Open(FilePath)

Set oWorksheet = oWorkbook.Worksheets(1)

oWorksheet.Activate

oExcelApp.Visible = False

Open in new window

0
 

Author Comment

by:okcuser
ID: 22831227
Norush - here is the exact error:
Server object error 'ASP 0177 : 80080005'
Server.CreateObject Failed
/isys/pc_HulkShipping.asp, line 45
80080005

when I run the following code:
'  Automate Excel to insert the built up string.
<%Set objExcel = Server.CreateObject("Excel.Application")  '  Create an Excel object.      
objExcel.Application.Visible = true
objExcel.Application.UserControl = true%>

This is all run inside <%@ Language=VBScript%>

Line 45 (where it fails) is the server.createobject line.  

When I look on the server a DW20.exe and Excel.exe process are created with my user account (running asp page on my machine) on the webserver.  When the application errors out, the excel.exe process goes away but the dw20.exe processes stay until I end them.  

exx1976 - I believe my code is almost the same as yours except that I'm not opening an existing excel document, but just creating a new one.  Here is the rest of my code - please look and see if I'm missing something.

Set objExcel = Server.CreateObject("Excel.Application")  '  Create an Excel object.
objExcel.Application.Visible = true
objExcel.Application.UserControl = true
                                          
Set ExcBook = objExcel.Workbooks.Add()
vSheetNum = 0
With ExcBook
     .Worksheets.Add
     .Sheets(1).Select
     .Sheets(1).Name = "Shipping"
...
     'Save
     .SaveAs FileName
     .Close
End With
'free resource                  
objExcel.Quit
Set ExcBook= Nothing    
Set objExcel = Nothing

This code worked until I upgraded the Office 97 on the webserver to office 2003.  My account is an administrator on the webserver so it would seem it isn't a permission issue since the processes are showing as created with my account.  

Thanks!
0
 
LVL 18

Assisted Solution

by:exx1976
exx1976 earned 100 total points
ID: 22831424
Code looks good to me..

But, if you're running this on a webserver, I know that Office 2003 does use ActiveX in order to render the pages..   It's been a LONG time, but have a google for SharePoint and Office.  I recall having to download some ActiveX controls in order to display Office content on my SharePoint server for users who do not have Office..  You didn't mention anything about SharePoint, but hopefully it will lead you to the ActiveX pieces you need..


HTH,
exx
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 7

Expert Comment

by:Norush
ID: 22831441
Two possible solutions:
1) log on as this anonymous internet user to the os (instead of using your own user id) on the IIS machine, then start Excel, wait for the msi-part to finish. Then start as the regular user again and your asp page should work
2) use a different user then anonymous login for this website, preferrably one which has started Excel once on the IIS machine otherwise you have to execute solution 1 for this user too
3) Download Office Web Components at http://www.microsoft.com/downloads/details.aspx?FamilyId=7287252C-402E-4F72-97A5-E0FD290D4B76&displaylang=en
0
 
LVL 7

Expert Comment

by:Norush
ID: 22831445
Actualy thats 3 possible solutions :)
0
 

Author Comment

by:okcuser
ID: 22832609
We do have a sharepoint server, but are still getting it set up.  I'm not actually displaying the Excel document after it is created, but instead just creating the file, saving it, closing excel, and emailing the file to the user as an attachment.  For word documents I have it open the word on their computer.  I'd like to have it open excel on their workstation as well, but for some reason it doesn't.  However, since I know what version of excel is on the server it works this way too (if I can get it to work again).

So, Norush, if I understand correctly, it is because IIS is using the anonymous iuser account to create the object that it won't let it work - is that because Office 2k3 has more security than 97?  So, if I log into the webserver as iuser_servername and start excel?  What is the pwd?  Or download and install the office web components onto the web server?  

I figured out that the dw20.exe process is an error process and checked the event viewer.  Attached is the errors generated in the web server application log when I try to run this page.
weberrors.txt
0
 

Author Comment

by:okcuser
ID: 22832784
Norush - one more question

"log on as this anonymous internet user to the os (instead of using your own user id) on the IIS machine, then start Excel, wait for the msi-part to finish. Then start as the regular user again and your asp page should work"

I'm not logged in with my account on the webserver/iis machine - it is logged in with a local admin account.  The excel.exe process is started with my account because I'm running the asp page from my personal workstation that is logged in w/ my user account.

0
 
LVL 7

Expert Comment

by:Norush
ID: 22833154
Yes okcuser, but the IIS-service runs under the anonymous internet user acount. Thats why i proposed that.
0
 

Author Comment

by:okcuser
ID: 22833603
Forgive me for being dense, it's been a long week already ... if I log into the webserver using the iusr_servername account, what password do I use?  I tried it with no password and it didn't work.  Since that account was created automatically I wasn't sure what it uses.

2nd question - if I download the office web components, will I need to change my code to use them or will that enable the activex controls so that the existing page works?  
0
 
LVL 7

Accepted Solution

by:
Norush earned 400 total points
ID: 22834346
Actualy my advice of order should be otherwise.

First try installing the office web components which should indeed solve your problems.

If it still does not work then you can go for option 2 with the iusr_servername login.
Change the servername password in the user-management so you can login with that user.
For a correct procedure to set the correct password back for this user you can check the following links:

- http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Microsoft_IIS/Q_22955181.html
- http://www.howtonetworking.com/internet/resetpassword.htm
0
 

Author Comment

by:okcuser
ID: 22834694
Well - I realized that after installing Office 2003, I never forced the windows update to run all the patches.  Once that was completed the application worked.  In the meantime, I had given the iuser account priv to the wwwroot folder as well.  

Thanks so much to both of you for your help!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now