LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Excel Won't Quit

I experienced the same issues. I'm using .Net Interop in VB.Net. I even
followed Jim Cone's post, but no help either. How do I kill a process/thread
in VB.Net?



"Inbar" wrote:

OK, in this case - you would to "kill" the EXCEL process. You can do this
with simple C# code. Let me know if you want help.

"Rex" wrote:

I tried both of your examples and in both cases, Excel remains in the process
list after my program ends. The fact that both of these as well as Inbar's
suggestions all fail makes me think there's something wrong in my
environment. In fact, the only way I've been able to get Excel to quit is to
*not* do the .Open. If I comment out the .Open and .Close lines, it works
fine. (Well, "work" is probably an exaggeration, but Excel goes away after
the Set XL=Nothing.)

Here's some more info, in case it means anything to anyone: I'm using VB
6.0 on XP SP2. Excel 2000 (9.0.6926 SP-3). The reference in my project is
to Microsoft Excel 9.0 Object Library.

Rex

"keepITcool" wrote:


you're using a mix of early and latebound code..
plus it may be easier to set a reference to the opened workbook
both the routines close completely on my machine..
(even if you set xl.Visible = TRUE
so you can test/see what's happening..)



Sub Early()
Dim XL As Excel.Application
Dim WB As Excel.Workbook
Set XL = New Excel.Application
Set WB = XL.Workbooks.Open("C:\temp\AnyOld.XLS")
WB.Close False
XL.Quit
Set XL = Nothing
End Sub

Sub Late()
Dim XL As Object
Dim WB As Object
Set XL = CreateObject("Excel.Application")
Set WB = XL.Workbooks.Open("C:\temp\Anyold.xls")
WB.Close False
XL.Quit
Set XL = Nothing
End Sub





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Rex wrote :

After running this code, Excel remains:
Dim XL As Excel.Application
Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open "C:\TEMP\AnyOld.XLS"
XL.Workbooks.Item(1).Close False
XL.Quit
Set XL = Nothing
Also tried .Close True and tried omitting .Close call.

What am I missing?
Rex



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't quit excel maven Excel Discussion (Misc queries) 0 March 15th 07 12:31 AM
Excel won't quit JRS Excel Discussion (Misc queries) 1 September 27th 05 04:31 AM
Excel doesn't quit Jos Vens Excel Programming 2 February 27th 04 01:08 AM
Can't get Excel to quit Todd Waldron Excel Programming 10 November 22nd 03 03:19 PM
Excel won't quit Jeff[_23_] Excel Programming 0 October 24th 03 05:14 PM


All times are GMT +1. The time now is 07:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"