>If you set the visibility of excel to false and then set loExcel to null
>
>Ex:
>
>loExcel = CreateObject('Excel.Application')
>loBook = loExcel.ActiveWorkBook
>lcFileName = "C:\Pam\statusreports\May-Data Man.xls"
>loExcel.Workbooks.Open(lcFileName)
>loExcel.Visible = .T.
I'm opening Excel like this:
x=getfile("xls")
oExcel=createobject("Excel.Application")
oExcel.Workbooks.open(x)
I get no error (except when there's no file), works just fine with Excel 97. I keep doing some extensive knitting around the workbook without having an object referrence to the workbook itself - the next line is oExcel.workbooks(1).activate, and I work with oExcel object only. Works just fine.
>loExcel.Visible = .F.
>* Closes the workbook
>loExcel.WorkBooks.Close
>*Releases the application
>loExcel = .Null.
I'm closing Excel like this:
oexcel.activeworkbook.close(1) && this should be equivalent to save+quit in Excel
release oexcel
It closes both the workbook and excel - in my case, that's exactly what I wanted, because I'm doing an automatic update where Excel remains completely invisible all the time.