Brian,
Is there a reason for releasing the oExcel object/variable in the calling program/method? Why not leave the variable until either you run the method again or close the form. Either way you can check to see if oExcel is type "O" and release it if necessary.
HTH
Barbara
>I think I know why this is occuring but I not sure how to fix it
>Background--
>In VFP3
>Ive got a program that does some calculations and then calls another 'excel pasting' program. The pasting program takes the currently opened dbf and Pastes the dbf contents into an excel template or spreadsheet starting at a specific cell. The pasting program ends like this
>oExcel.Visible = .T. && so user can see it
>release oexcel
>return
>
>Then the calling program does some maintainance activity..updates.. replace etc...... before if ends.
>
>My problem--
>When the pasting program returns to the calling program I get the error 'Excel has performed an illegal opperation'.
>While this is a non fatal error and doesnt affect foxpro or the data it is obviously unwanted and has netted me 2 calls today by users who were afraid they did something wrong. I think it has to do with releasing the object before I quit the application-- but issuing an oxecel.quit after Oexcel.visible will close down the application immediately. Any suggestions?
>
>
>Thanks for your help
>Brian