Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I cannot close Excel.application

Status
Not open for further replies.

Lenka

Programmer
May 13, 2002
6
US
I need to send my DBFs to Excel spredasheet with full functionality. I use the same procedure. All but one work fine. This particular procedure sends 17000 records to Spreadsheet with 12 columns.

loExcel=CREATEOBJECT("Excel.Application")
WITH loExcel
.Workbooks.ADD
.RANGE("A1").VALUE="Date:"
..........................
.RANGE("L1").VALUE="...."
lnRow=2
SELECT TEMPRPT
SCAN
.Cells(lnRow,1).VALUE=TEMPRPT.Field1
....................................
.Cells(lnRow,12).VALUE=TEMPRPT.Field12
lnRow=lnRow+1
ENDSCAN
ENDWITH
loExcel.ActiveWorkbook.SaveAs(cName)
loExcel.ActiveWorkbook.Close
loExcel.Application.Quit
RELEASE loExcel

After executing of this procedure my XLS file is Ok, but EXCEL still open.

What's wrong?
 
try
this is what I use and the instance goes away

loExcel.quit

also known to work on occasion
loExcel=null

note before the release loExcel Steve Bowman
steve.bowman@ultraex.com

 
The "loExcel = .null." worked for me but just loexcel.quit and/or release loExcel doesn't. Dave Dardinger
 
Thank you, but it does not work either.
I added
loExcel.Application.Quit
loExcel.Quit
loExcel=.NULL.
RELEASE loExcel

But after all my Excel still open.
 
Well, now I don't know what your problem is. When I played with it yesterday, I also had excel.exe in memory after .quit and release, but when I did the =.null. which Steve suggested, it disappeared from Task Manager.

Is this the largest of the files you try transporting, or does it have some special aspect like a general field? And what OS and version of Excel and VFP are you using? Dave Dardinger
 
Depending on the version of Excel, you might have a problem with 17000 records. Version 5 (I think it was 5) and earlier had a limit of 16384 rows. Later versions upped that limit to 65536.

It could be that some kind of error condition exists in Excel which is why it won't respond to the Quit command. That's just a guess, though.

Ian
 
That what I was wondering, though I'm not sure why it'd keep the app open, unless there's a error message somehow hidden which he never sees. Dave Dardinger
 
Strange, I was just working with this and that is the same conclusion I came up with, something going on that prevents excel from closing that the use is not aware of

try this
after you do the
loExcel.Application.Quit
try
loExcel.visible=.t.
and see if there are any errors going on. Steve Bowman
steve.bowman@ultraex.com

 
I tried it on Windows 98 and Windows ME. I have VFP5 and Office 2000.
I have only about 1700 records, but I need to create 12 columns in Excel spreadsheet. I think my problem relates somehow to the columns number, because when I tested my program and eliminated Columns numbet to 8, it worked perfect for the same amount of records. However, when I added 9th column, I got the same problem again.
I can see my open Excel in Task Meneger, and if I would like to continue, it freezes up my computer.

Thank you all for your help.

Helen
 
I tried what Steve Bowman adwised and I haven't got any errors.
But result is the same. I have unclosed Excel in the Task List.

Thanks,
Helen
 
Just a thought. At the end of your proccess, just make it visible and close it with the exit button in Excell. Does it go away in the task manager?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top