You know, I thought in the same way as you and tried that, but for some 
f...g reason the Excel object would not die.

If, however, I put the kill code between the finally and the endtry, it 
works. Spent almost an hour trying to figure out why, but did not 
succeed. I could not loose any more time on this, so the final code is:

try

   (all the excel automation code here)

catch

   messagebox('Excel caused an error')

finally

   thisform.oExcel.quit
   thisform.oExcel = Null
   Release thisform

endtry

That did it, but I still wonder why if the kill code goes in the catch, 
the Excel object doesn't die.

Rafael Copquin



El 14/06/2010 12:50, Stephen Russell escribió:
> On Mon, Jun 14, 2010 at 10:18 AM, Rafael Copquin<[email protected]>  
> wrote:
>    
>> You and Stephen Russell made the same suggestion and I tried it.
>>
>> It works beautifully!
>>
>> I'll have to rewrite my error catching routine, but this is the way to go.
>>
>> Thank you both!
>>
>>      
> ---------------------
>
> There was a big diff between our catch / finally.
>
> I clean the failed excel object in the catch and Alan put that to the
> finally.  From my C# code I would encase my excel object in a using
> statement so it would ALWAYS clear all objects within the block when
> code was completed, and in the catch I make sure that it is cleared.
>
> Just to give you a heads up between the two suggestions.
>
>
>    


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to