I've been using the following technique to open an instance of Excel for years:

If Upper(Vartype(Thisform.oExcel)) = "O"
    Thisform.oExcel.Quit
    Thisform.oExcel = null
Else
    Thisform.AddProperty('oExcel')
Endif

If Upper(Vartype(Thisform.oExcel)) <> "O"
    Thisform.oExcel=Createobject("Excel.Application")
Else
    Thisform.oExcel=Getobject(,"Excel.Application")
Endif

The above is taken from the Hacker's Guide

However, sometimes Excel throws an error.
Therefore in my form class error method I put this construct:

If nError = 1426  && Excel error

   If Vartype(thisform.oExcel ) = "O"

      thisform.oExcel.quit
      Thisform.oExcel = null

    endif
endif

Yet, it does not kill the Excel instance. I mean, the Excel instance is still open. It just does not go away. The only way to kill it is to open the task manager and kill it manually

I follow the Excel method step by step, and reproduce the error condition. The error method fires, the oExcel object exists, the line "thisform.oExcel.quit" executes, but it does not kill the Excel instance

????????

Rafael Copquin


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.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