|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
heya
I have a few questions about your post, please email me at nickd at sti-k12.com, thanks
![]() |
|
#3
|
|||
|
|||
|
More than likely it's a permissions problem where the IIS webserver user account doesn't have adequate permissions to some part of Excel.
For testing, if your server isn't exposed to the net you can temporarily add the IIS user account (normally IUSR_computername) to the local administrators group and see if your code runs properly.
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Excel Macro Hangs in ASP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|