Alaska Software Inc. - How do I get Excel to close?
Username: Password:
AuthorTopic: How do I get Excel to close?
Bruce AndersonHow do I get Excel to close?
on Tue, 22 Jun 2010 08:17:20 -0500
I have an application which uses both MSWord and Excel, and I cannot get 
Excel to close at the end of the procedure.

I open a Word document (:visible := .F.) and merge some data into it.

I then open Excel (:visible := .F.), create a table and copy the table to 
the clipboard.

Next, I try to close Excel with this code.  I do not save the worksheet.
   oWorkBook:close(.F.)
   oExcel:quit()
   oExcel:destroy()
   oExcel := nil
   sleep(10)

Then, I paste the table into my Word doc, export the doc as a PDF, and close 
MSWord with this code.  I do not save the document.
   oDoc:close(.F.)
   oWord:quit()
   oWord:destroy()
   oWord := nil

When I look in the Task Manager, Excel is still running as a process and 
Word is not there; it has closed.

If I run the procedure a second time, I will have two instances of Excel 
running at conclusion, and no instances of MSWord.

How do I get Excel to close?
AUGE_OHRRe: How do I get Excel to close?
on Tue, 22 Jun 2010 16:33:14 +0200
hi,

>   oWorkBook:close(.F.)

i think Parameter .F. is wrong. Workbooks.does not have a Parameter

if you meen Workbook the Parameter are
object.Close(SaveChanges As Variant, Filename As Variant, RouteWorkbook As 
Variant)

also you did not "test" on ComLastError() > 0 so you can not know it you 
have realy :quit to :destroy()

greetings by OHR
Jimmy