|
-
Apr 7th, 2003, 09:49 AM
#1
Thread Starter
Junior Member
ASP Excel GetObject
I am developing an ASP app that needs to retrieve an already open instance of Excel, grab it, do what it has to do and then that's pretty much it.
I 1st tried to use Server.GetObject in ASP, but I received the following error:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'Server.GetObject'
So then I proceeded to make an ActiveX DLL that would do this for me, and all I would have to do is create an instance of the DLL in my ASP page and it should work right??? Well the DLL worked as planned when I ran it in a VB6 app/project group, but when I ran it in an ASP script, the GetObject in the DLL didn't work.
My DLL tries to get an instance of Excel, and if it doesn't exist, it creates a new one. So therefore I know that when the script is ran, for some reason, the GetObject in the DLL is not working.
Is there something that I need to do on my machine or in my wwwroot directory, or am I doing something wrong?
Please Help...
"Pain is Weakness Exiting the Body"
-
Apr 7th, 2003, 09:58 AM
#2
There is no Server.GetObject in VbScript. You need to re-evaluate what you want to do, because while you can create an Excel instance in ASP, it has some serious threading issues.
-
Apr 7th, 2003, 12:19 PM
#3
Thread Starter
Junior Member
Ya that's why I moved the excel handling into the DLL. Still the GetObject works from a VB App, but not from a script. Is that what you were talking about? Is there a reason why it only works in a VB App and not an ASP script???
"Pain is Weakness Exiting the Body"
-
Apr 7th, 2003, 12:29 PM
#4
VbScript is very limited compared to full VB. Even if it did have GetObject, ASP wouldnt work with it probably due to how ASP processes run isolated compared to other applications. Its a bunch of technical mumbo jumbo!
-
Apr 7th, 2003, 12:38 PM
#5
Thread Starter
Junior Member
No I know its limited but how come the DLL doesn't do the same work in the script. I'll give u an example of what I am doing.
MyDll.MyClass is the DLL and the class that I made in it, which get/open and close excel.
In VB6 App I do the following,
which works exactly how I want it to:
'***************************
Dim obj as MyDll.MyClass
Set obj = New MyDll.MyClass
'Get already open instance of Excel
' if one doens't exist, it will create a new one
obj.GetExcel
obj.CloseExcel
Set obj = Nothing
'***************************
In ASP I do the following,
which winds up opening a new instance of excel and closes it:
'***************************
Dim obj
Set obj = Server.CreateObject("MyDll.MyClass")
'Get already open instance of Excel
' if one doens't exist, it will create a new one
obj.GetExcel
obj.CloseExcel
Set obj = Nothing
'***************************
Is that normal for the DLL to not perform the same way when ran from the server. My ASP page is not accessing excel directly. I know that won't work the way I want it, but I thought a DLL would perform the same way regardless of where it is ran from???
"Pain is Weakness Exiting the Body"
-
Apr 7th, 2003, 12:50 PM
#6
Now you are confusing me. what do you mean perform different? You dont make any example of how it performs differently. You only showed how Vb6 does it and how VbScript does it. It is like you are asking parts of 2 different questions.
Now if I can understand you, GetObject doesnt work in the dll called from ASP. I think it is still the same problem as i mentioned earlier. ASP runs in an isolated process so I dont think you can 'Get' and object.
-
Apr 7th, 2003, 01:26 PM
#7
Thread Starter
Junior Member
Sorry if I didn't explain better.
If I run the non-script one, the dll grabs an already open instance of excel and closes it.
If I run the script one, the dll doesn't grab the already open instance. It opens a new one and closes it.
That's what I mean by performing differently. The VB6 app and ASP script are both using the exact same dll, but it is not working the same in both cases. One grabs an already open app and the other one doesn't.
But ya it probably is b/c of what you said:
"ASP runs in an isolated process so I dont think you can 'Get' and object"
Thanks Anyway...
"Pain is Weakness Exiting the Body"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|