HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 17th, 2004, 04:45 PM
neoacid neoacid is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 19 neoacid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Excel Macro Hangs in ASP

I have a problem that i have been unable to resolve for some time now. I have tried searching on google and MSDN for
a specific solution, but haven't found any. Essentially, I'm trying to get VBScript code in a web page to open an Excel workbook
on the server and run a macro from the workbook on the server. I was able to make this work when I was using IIS 4.0
and Office 97; however, it still behaved strangely at times and would hang whenever an error occurred in the macro.

Recently, i migrated my server to Windows 2000 Server with IIS 5.0 and Office 2000. Now, when i view the scripted web page,
it will not open any workbooks that contain macros without causing Excel to hang. When i go to task manager to try
to end the Excel process, it says "Access Denied" and will not allow me to terminate it, so i have to reboot every time it hangs.

I have set the macro security on the server to low so that it doesn't bring up the macro alert message.
I have also set the permissions in IIS to allow for scripting and executing files.
The macro code is not to blame for sure, because I don't even call the macro and I get the same problem with an
empty macro module in the workbook. However, if i remove the module from the workbook, the script will execute
just fine without causing Excel to hang.

I have also tried running the same code from a *.vbs file locally on the server,
and it runs correctly. But again, when I try to run the *.vbs file from the web page using the Windows Scripting Host Object
to make the call, it causes wscript.exe to hang and I cannot terminate it. I would rather have the code inside of the asp
web page because i have to do this with several workbooks.

Here is an example of the code in my web page:

dim ExcelApp, ExcelWB, cellcount
set ExcelApp = Server.createobject("Excel.Application")
ExcelApp.visible = true
set ExcelWB = ExcelApp.Workbooks.Open("C:\inetpub\wwwroot\Asp Test SpreadSheet.xls")
cellcount = ExcelWB.Sheets(1).UsedRange.Cells.Count
ExcelWB.Close
ExcelApp.Quit
set ExcelWB = nothing
set ExcelApp = nothing


If "Asp Test SpreadSheet.xls" has an empty macro module in it, it will cause Excel to hang on the server. Task Manager
gives a message "Access Denied" when i try to terminate it. Without any modules, the script works.

Also, can someone tell me why "ExcelApp.visible = true" doesn't make Excel visible on the server? If it is visible,
then shouldn't I see sometype of error message from Excel if the error lies in Excel?

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Excel Macro Hangs in ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT