Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_discuss thread: Kill Excel object in session_OnEnd


Message #1 by "yuri" <yuribrsk@r...> on Thu, 17 Oct 2002 14:31:03
I have problem to close Excale Application on session_OnEnd event in 
global.asa 
My Globalasa looks like that:

<script language=vbscript runat=server>
sub Session_OnStart
	Session.Timeout = 1
	Set session("xmlObj") = Server.CreateObject("Excel.Application")
	call session("xmlObj").Workbooks.Open(Server.MapPath("db/Reporting 
Template4.xls"))  
	
	'------------------for test purpose-------------------------'
	set session("fso")= Server.CreateObject
("Scripting.FileSystemObject")
	set fn = session("fso").CreateTextfile("c:\start.txt")
	set fn=nothing
	'------------------ end -------------------------'
end sub

sub Session_OnEnd
	'call session("xmlObj").run("KillApp")
	set fn = session("fso").CreateTextfile("c:\end0.txt")
	session("xmlObj").Application.DisplayAlert=False
	set fn = session("fso").CreateTextfile("c:\end1.txt")
	session("xmlObj").Application.ActiveWorkbook.Close(False)
	set fn = session("fso").CreateTextfile("c:\end2.txt")
	session("xmlObj").Application.Quit
	set fn = session("fso").CreateTextfile("c:\end3.txt")
	set fn=nothing
	Session.Abandon()
end sub	

</script>

I tried everything. Run function in Excel macro, which would close 
application itself. I also trying close it in session_OnEnd

The above code shows that I try to create text file after each procedure 
in session_OnEnd but after creating end0.txt nothing happen?

Does anyone had that kind of problem?
What should i do to close Exel Application?
Please HELP!!! :-(

  Return to Index