>Sorry to keep asking Q's friends. Maybe one day soon I'll be an automation wizard buit at the moment I'm on the steep bit of the curve.
>
>It's a good idea to close the Excel app after creating and manipulating a w/b or sheet., otherwise Excel.exe remains as a process but only shows up in the Task Manager, and if you try to create another incidence you can get a dispatch error over the contention (something like that anyway).
>
>You create the w/s and open it for the user to inspect
>
>But there are 2 scenarios:
>
>a) the user looks at it and closes, either the workbook (leaving the Excel shell), or Excel proper
>b) they look at it and go back to the VFP app window, without closing
>
>In case a), attempting to close Excel, from the VFP code causes an error.
>In case b), you can get the above mentioned dispatch error if try to do another export in the same VFP session.
>
>So 'twould be nice to ascertain whether or not an incidence of Excel is running before deciding what to do.
>
>How to do this please?
>
>'ppreciate it
>
>Terry
That is why when I use automation after I show Word (in my case) I going in a loop untill Word is closed. Something like:
....
oExcel.Visible = .t.
DECLARE Sleep IN WIN32API INTEGER
DO WHILE TYPE(oExcel.Name]) == [C] AND;
NOT ISNULL(oExcel)
Sleep(300)
ENDDO
oExcel = NULL
RELEASE oExcel
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.