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

Excel Process won't Quit

Status
Not open for further replies.

k2a

Programmer
Jun 26, 2012
133
DE
Hi to all,
I create an Excel process and fill an array, than close the Excel process. This works fine with small Excel tables having about 850 rows.
However, using Excel tables with up to 1500 rows it fails, that means the Excel process does not quit.

The method involved keeps in a wait state because the EXCEL.EXE process is still alive.

The creation of the Excel process goes like this:
loExcel = CREATEOBJECT("excel.application")
loExcel.Workbooks.Open(gcSourceFile)

And to closing the process like this:
loExcel.Workbooks.Close()
loExcel.Quit()

Has anyone an ideas how to fix that?
Any suggestions are appreciated.

Regards, Klaus
 
OK Dan I understand your point to avoid confusion better not using terms which are not common in Foxpro. For the future I try to be precise as possible.

The problem with my public array which disappears alternately still exist. One time it stays there and the next time it disappears. Nothing has changed just restated the form again. In the meantime i moved the array into a from property and here it never disappears. The reason to declare the array as public is because it take a few minutes to create it from a large Excel table.

Regards, Klaus
 
As I said before, the behavior you describe CANNOT happen unless a) you're releasing the array (CLEAR or RELEASE commands) or b) the array is not public when you think it is.

You have not given enough details for anyone to guess what's going on here.
 
Klaus, the best way to solve this kind of problem is to step through the code in the Debugger. Clearly, the array was getting cleared somewhere. You need to look closely at the code, while it's executing, to see where that's happening. Much as we would like to help you with this, it's really something you have to do yourself, as only you can see the entire code.

You say you can avoid the problem by making the array a property of the form. In most cases, that would be a good approach. Form properties are prefereable to public variables. However, in this case, you had a good reason for using a public variable (to avoid the overhead of populating the array each time the form loads). If I was in your position, I'd try to find why it wasn't working as a publc variable, rather than avoiding the situation and ending up with something that's not quite what you want.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi Dan,

I would suggest to close this thread and open a new one, because the problem with "Excel Process won't Quit" has been solved.
The name of new thread will be "Public Array disappears"

Regards, Klaus

 
Hi Mike, glad to hear from you.

I used the Debugger to locate the problem, but could not find any mistake in my code. What really confuses me is the fact that one time the Public Array stays there and the next time it disappears. BTW, as i told Dan i'll start a new thread and give more details.

Regards, Klaus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top