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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel being left in memory

Status
Not open for further replies.

clegg

Programmer
Jan 25, 2001
98
GB
Hi All,

Right, I've finished my Word/OLE/COBOL mailmerge program and it works just fin and dandy!

You can feel the but coming right - BUT when its finished and I do a Ctl/Alt/Del i've still got Excel processes running. I'm using Excel to open a csv file and save it as an XLS file. Word then opens this XLS file to use as the data source.

I'm using the 'finalize' method when i've converted the CSV file - so I'm assuming its the merge action thats leaving the other Excel process open - but how do I close it?

Kind regards as always

Clegg
 
Any chance your Excel object reference is invalid at the time you call finalize? I suspect calling finalize on an invalid handle will not result in any errors, but will certainly not destroy the object.

I'd think that finalizing Word would destroy any Excel objects created by Word (but perhaps Microsoft has a bug there?)

Glenn
 
I've fixed it!!

I tracked the problem down to some formatting that I was doing.

I had the following code:

invoke Worksheet "getRange" using
by value z"S:V"
returning CellRange.
invoke CellRange "setNumberFormat" using
by reference "£#,##0.00".

invoke Worksheet "getRange" using
by value z"AW:AX"
returning CellRange.
invoke CellRange "setNumberFormat" using
by reference "£#,##0.00".

etc etc etc...

And at the end I had:

invoke CellRange "finalize" returning CellRange.

Once I realised that i had to put the "finalize" after each set of invokes it worked properly.

Thanks for the help.

Clegg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top