Excel instances remain opened

  • Thread starter Gérard Ducouret
  • Start date
G

Gérard Ducouret

Hello
I'm trying to create a new instance of Excel (from MS Project) with the
following :

Set XLApp = New Excel.Application
If XLApp Is Nothing Then
Set XLApp = New Excel.Application
End If

then to close it by :
XLApp.Workbooks.Close
Set XLApp = Nothing

but all the Excel instances remain opened : in the Tasks Manager of Win 2000
I have as many EXCEL instances than I ran the macro.

Thanks for help,

Gérard Ducouret
 
S

Simon Murphy

Gérard
You are not quitting Excel
Try
xlapp.workbooks.close
xlapp.quit
set xlapp = nothing

note workbooks.close is going to throw up a msgbox to save changes
better to use
xlapp.worksbooks(1).close savechanges:=true (or false)
cheers
Simon
 
G

Guest

Tom-

I have been working on a simmilar problem that seems to be machine specific.

Even running the code from Microsoft in your second reference to this
answer(shown below), my machine will not release the reference and Task
Manager holds on to the instance(EXCEL.EXE)??run it 5 times get 5 instances
that do not go away...

I have cut & pasted to another PC and it works the way you and MS say it
should.

I have unloaded all Addins in Excel and VBE.

Rebooted and have "nothing" else running.

"nothing" = MSspyware beta & Norton Systemworks 2005

I'm running XP pro & XL2003

Any Ideas where to look next?

CODE From Site:

Option Explicit

Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets("Sheet1")
xlSheet.Range(xlSheet.Cells(1, 1), xlSheet.Cells(10, 2)).Value =
"Hello"
xlBook.Saved = True
XlBook.close
Set xlSheet = Nothing
Set xlBook = Nothing
xlApp.Quit
Set xlApp = Nothing
End Sub
 
G

Guest

Tom Thanks, Comming from you that meant it was not an Excel issue

Turns out i had downloaded ACT! 6.0
It was loading its own addin into Excel
when I looked at Task manager Word also had a "phantom instance"
I uninstalled ACT! 6.0 and the problem went away

I will post over to Sage Act! and find out if there is a fix, short of
uninstalling.

Will post back

Thanks again, for helping me know where not to look.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top