Page 1 of 1 1
Topic Options
#88775 - 2002-10-19 07:28 PM Problems Closing Excel
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Some help please on properly closing Excel 2000. I am using the following to open and close an existing Excel spreadsheet:

$CurFil = "C:\Temp\Current.xls"
$oXL = CreateObject("Excel.application")
$RC = $oXL.Workbooks.Open ($CurFil)

(add data here)

$oXL.UserControl = 1
$oXL = $oXL.ActiveWorkbook.Save
$RC = $oXL.Close
$oXL = $oXL.Application.Quit

Using TLIST from Resource Kit I see an Excel process still running, and at times the spreadsheet opens in read only mode as another process is using it.

I have tried variations on some of these commands that are posted elsewhere on this board:
+ $RC = $oXL.ActiveWorkbook.Close
+ $oXL = $oXL.Quit
+ $oXL.Application.Quit

However, none seem to work in completely ending the Excel process that was started. So, what am I doing wrong here?

Bill

[ 19. October 2002, 19:29: Message edited by: bleonard ]

Top
#88776 - 2002-10-19 07:38 PM Re: Problems Closing Excel
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I have verified using Task Manager that the following code runnning under KiXtart 4.12b2 starts and stops Excel.
code:
$oXL = CreateObject("Excel.application")
? "Excel processing is now running. Press any key to continue."
get $
$oXL = 0
? "Excel is no longer running. Press any key to exit program."
get $



[ 20. October 2002, 01:37: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#88777 - 2002-10-22 10:17 PM Re: Problems Closing Excel
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Bill ,

there is an 'application' too much

instead of

$oxl = $oxl.Application.Quit

say

$oxl = $oxl.Quit

[Wink]

Howards example will work too ... Of course !

Jochen
_________________________



Top
#88778 - 2002-10-23 12:55 AM Re: Problems Closing Excel
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Howard and JPols - thanks, these solved my problem.
Bill

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 641 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.051 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org