Cannot close Excel with WIN32OLE
Cannot close Excel with WIN32OLE
Is there anybody who knows,
what i can do to close Excel ?
With the old TAutoOle : oExcel:End() it was ok.
Antonio told me : oExcel := NIL.
It is not working, because in the Filemanager
Excel is still visible and not closed.
Regards U.König
what i can do to close Excel ?
With the old TAutoOle : oExcel:End() it was ok.
Antonio told me : oExcel := NIL.
It is not working, because in the Filemanager
Excel is still visible and not closed.
Regards U.König
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
End Excel-Worksheet
oExcel:Quit()
oExcel := NIL
works fine.
but it creates the worksheet in the background.
I tried to do nothing on the end.
It works also, but with the difference : Excel shows the sheet
and stays open.
I have to close excel with the button ( because I want to check the sheet )
A Test with the Taskmanager shows, that Excel is closed.
Thank you
U. König
oExcel := NIL
works fine.
but it creates the worksheet in the background.
I tried to do nothing on the end.
It works also, but with the difference : Excel shows the sheet
and stays open.
I have to close excel with the button ( because I want to check the sheet )
A Test with the Taskmanager shows, that Excel is closed.
Thank you
U. König
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
What if you try this way
oExcel:WorkBooks:Close()
oExcel:Quit()
Regards
oExcel:WorkBooks:Close()
oExcel:Quit()
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
This is definitely not true. Please, show a sample to demonstrate the problem.Gale FORd wrote:I thought the same as you, but after helping someone with an Excel problem we found that Excel will still be running even though you cannot see it.
Running the task manager after doing the oExcel:quit() shows that Excel would still be resident until the variable was set to nil.
EMG
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
I went back and looked at my test prg's and I could not find the one in question so I created one. At first it worked like you said and what I thought originally. Then I got to thinking about how this problem came up. Then I recall that the problem showed up when the function was still running or the variable was a static.
Code: Select all
FUNCTION MAIN()
LOCAL lRunTest := .t.
LOCAL oExcel, oSheet
clear screen
do while lRunTest
@ 10, 0 say 'Run Excel Test ' get lRunTest picture 'y'
read
if lastkey() = 27
exit
endif
if lRunTest
@ 20, 0
// This does not work
// even though you tell excel to quit it is still
// running until variable gets reset.
oExcel = CREATEOBJECT( "Excel.Application" )
oExcel:quit()
@ 20, 0 say 'Ok now check with Task Manager'
wait
// Works if you run in function that releases variable
// or you release variable yourself
oExcel := nil
TestExcel()
@ 20, 0 clear
@ 20, 0 say 'Ok now check Task Manager again'
endif
enddo
RETURN( nil )
FUNCTION TestExcel()
LOCAL oExcel, oSheet
oExcel = CREATEOBJECT( "Excel.Application" )
oExcel:quit()
RETURN( nil )
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
It was a problem for the person I was helping some time ago because he was using a prg wide static variable. The person in this thread mentioned that Excel was still running so without seeing how he was using the variable I wanted to make sure the variable lost the connection with Excel.
Have a great day.
Have a great day.
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact: