Excell remains active

This forum is for general support of Xbase++
Post Reply
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Excell remains active

#1 Post by skiman »

Hi,

I'm using activeX to read some XLS files.

When the import is done, I have a 'oExcel:Destroy()'. If I check with Taskmanager, it looks as Excel remains active after this destroy.

Some hints to prevent this? Or correct way to stop Excel?
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Excell remains active

#2 Post by rdonnay »

This is my code from DC_WorkArea2Excel():

Code: Select all

oSheet:destroy()
oBook:close()
oBook:destroy()

// Quit Excel
oExcel:Quit()
oExcel:Destroy()
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Excell remains active

#3 Post by skiman »

Thanks Roger,

Problem is solved.

Finding the last row of a sheet isn't very simple to find. In case anyone ever needs this, the following seems to work correctly:

oUsedRange := oSheet:usedrange
nMaxLines := oUsedrange:rows:count()
Best regards,

Chris.
www.aboservice.be

Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

Re: Excell remains active

#4 Post by Koverhage »

Chris,

or this way

oBook:Worksheets(1):activate() // Activate sheet

oSheet := oBook:Worksheets(1) // Shortcut

oExcel:Application:ActiveCell:SpecialCells(xlLastCell):Select

nRow := oExcel:Application:ActiveCell:Row
Klaus

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Excell remains active

#5 Post by rdonnay »

I receive the entire worksheet into an array with the following:

Code: Select all

aValues := oBook:workSheets(1):usedRange:value
The eXpress train is coming - and it has more cars.

Post Reply