Execute Excel macro with asp?
I'm creating a webpage in traditional ASP. What I'm doing is running Macros in different excel files. At the begining i had a lot of problems with security issues when launching DCOM objects etc. but they are all solved.
Just as long as I develop, I'm using administrator account for the webserver (instead of IUSR_acount). So far so good.
In one of the Excel files where I call a macro the webpage hangs until timeout.. The problem is only this macro. I've tried running a lot of macros in the same excel file and they work just fine. But just this macro (which I haven't开发者_运维百科 made myself) wont work.
I tried to open a new word document and from that document make a Call for the macro in the excel file and then it works, but when calling it from an ASP webpage it doesn't work.
The only deviance in this particular macro that I can see is that the macro code creates a variable holding an object like (Set varObj = New Garp.Application). GARP is an old business intelligence system. And the reference that is called upon creating the object is the executeble file (.exe) that holds the interface communicating with GARP server.
This is the only thing that i can think of that could cause the webpage to "hang".
But still: There is no problem executing the macro if i manually open word and execute the excel macro from it (with the exact code as in webpage). All other macros, in the same file and other works like a charm to be executed from the webpage.
I really don't have a clue what to look for??
The server is an Windows Server 2003 R2 x64, and i'm trying all code directly from the server..
Try using Server.CreateObject
to create the Garp.Application instead of New
. That somehow lets COM understand that there's an external object around.
It sometimes helps to force-clear any references to the object when you're done with it:
Set x = Server.CreateObject("Garp.Application")
' use x
Set x = Nothing
精彩评论