Server.CreateObject("Excel.Application") 
Author Message
 Server.CreateObject("Excel.Application")

I use a ASP-file to put a variable ia an Excel-sheet let the Excel-sheet
do its trick and get the resulting variable.
This works fine on the server. Only the instance of Excel will not
close. So I'm getting a lot of Excel-instances and the files opened by
them can't be modified or deleted.
I need to close Excel after I've got the resulting variable.
Here's the code:

 Set xlApplication = Server.CreateObject("Excel.Application")
 ' Open str_newFile
 xlApplication.Workbooks.Open str_newFile
 Set xlWorksheet = xlApplication.WorkSheets(1)
 xlWorksheet.Range("a1") = 1
 response.write (xlWorksheet.Range("a11"))
 xlApplication.Quit 'Close the Workbook
 Set xlWorksheet = Nothing
 Set xlApplication = Nothing

Why isn't Excel released from memory????

Thanks in advanced

Paul

--
**************************
Snow is just frozen water!
meems.cjb.net
**************************

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Server.CreateObject("Excel.Application")
Excel is a desktop application and not suitable for server-side automation.



Quote:
> I use a ASP-file to put a variable ia an Excel-sheet let the Excel-sheet
> do its trick and get the resulting variable.
> This works fine on the server. Only the instance of Excel will not
> close. So I'm getting a lot of Excel-instances and the files opened by
> them can't be modified or deleted.
> I need to close Excel after I've got the resulting variable.
> Here's the code:

>  Set xlApplication = Server.CreateObject("Excel.Application")
>  ' Open str_newFile
>  xlApplication.Workbooks.Open str_newFile
>  Set xlWorksheet = xlApplication.WorkSheets(1)
>  xlWorksheet.Range("a1") = 1
>  response.write (xlWorksheet.Range("a11"))
>  xlApplication.Quit 'Close the Workbook
>  Set xlWorksheet = Nothing
>  Set xlApplication = Nothing

> Why isn't Excel released from memory????

> Thanks in advanced

> Paul

> --
> **************************
> Snow is just frozen water!
> meems.cjb.net
> **************************

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Server.CreateObject("Excel.Application")
This happens because you're releasing the objects in the wrong
order. The correct one should be

Set xlWorksheet = nothing
xlApplication.Workbooks.close
xlApplication.quit
set xlApplication = nothing

At least it works in my system ;)

Greetinx,
SMUDO

Quote:
> I use a ASP-file to put a variable ia an Excel-sheet let the Excel-
sheet
> do its trick and get the resulting variable.
> This works fine on the server. Only the instance of Excel will not
> close. So I'm getting a lot of Excel-instances and the files opened by
> them can't be modified or deleted.
> I need to close Excel after I've got the resulting variable.
> Here's the code:

>  Set xlApplication = Server.CreateObject("Excel.Application")
>  ' Open str_newFile
>  xlApplication.Workbooks.Open str_newFile
>  Set xlWorksheet = xlApplication.WorkSheets(1)
>  xlWorksheet.Range("a1") = 1
>  response.write (xlWorksheet.Range("a11"))
>  xlApplication.Quit 'Close the Workbook
>  Set xlWorksheet = Nothing
>  Set xlApplication = Nothing

> Why isn't Excel released from memory????

> Thanks in advanced

> Paul

Sent via Deja.com http://www.deja.com/
Before you buy.


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CreateObject("Excel","//server"), MsgBox output

2. CreateObject("Excel","//server"), MsgBox output

3. Set xLApp = CreateObject("Excel.Application")

4. CreateObject("Excel.Application") Fails on NT

5. CreateObject("Excel.Application") problem

6. CreateObject("Excel.Application")

7. CreateObject("Excel.Application")

8. CreateObject("Excel.Application") Error

9. CreateObject("Excel.Application")

10. GetObject("","InternetExplorer.Application") fails in Excel VBA

11. GetObject("","InternetExplorer.Application") fails in Excel VBA

12. Createobject, excel "times out"

 

 
Powered by phpBB® Forum Software