Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Won't Unload...


I have an app that has a couple grids. If I load either grid from a
Excel file, no matter what I've tried, Excel will close, but no
disappear from the task manager.

I was getting all kinds of strange errors; and sometimes my cod
worked, sometimes it didn't. I finally figured out that EXCEL.EXE wa
still running (in task manager), and if I tried to load another gri
from an Excel file I'd get errors. For example, I had severa
formatting commands that sometimes worked - but ONLY if I loaded tha
grid FIRST.

Anyways, I am opening Excel, and asking for a file name, doing stuff
then want to close via code in a sub when I'm done:

Set objExcel = CreateObject("Excel.Application")
Set objBook = objExcel.Workbooks.Add
Set objSheet = objExcel.Sheets(1)
< save as xxx

to close:

objExcel.DisplayAlerts = False

' objBook.Close(SaveChanges:=False) ' <-- ** or True **

ActiveWorkbook.Close False
ThisWorkbook.Close
objExcel.Close
objExcel.Quit

Set objExcel = Nothing
Set objSheet = Nothing
Set objBook = Nothing

Tyring all kinds of stuff - but EXCEL.EXE still in task manager! An
ideas? Thanks

--
Steven8
-----------------------------------------------------------------------
Steven8R's Profile: http://www.excelforum.com/member.php...fo&userid=1548
View this thread: http://www.excelforum.com/showthread.php?threadid=27064

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Excel Won't Unload...

Looks to me like you are using the right steps - that is, closing the book,
quitting the app, setting all your Excel object references to Nothing. That
should be enough to clear out the session you started. Unless something else
is happening in the code you did not include. Do you create any other object
variables, and are they pointing to anything from that Excel session? Are
you sure the code you list at the end is actually running? Not bypassed, for
example, by an error handler?

If you still can't figure it out, to debug you might try this: if your
objExcel is not visible, set Visible to true, then try breaking your code at
critical points (set breakpoints, or do like I do - Msgbox that pops up with
message saying where I am in code, then I Ctrl-Break to get to the debugger
if I want to). I would suggest trying after each critical step - saving the
workbook, closing it, quitting the session, and setting everything to
Nothing. See what the state of the session is at those points by looking at
the app, using the debugger, peeking in Task Manager. Might help you find
where it is getting hung up.

Wish I could help some more, but looks like some debuggin is in order.
Good luck...

"Steven8R" wrote:


I have an app that has a couple grids. If I load either grid from an
Excel file, no matter what I've tried, Excel will close, but not
disappear from the task manager.

I was getting all kinds of strange errors; and sometimes my code
worked, sometimes it didn't. I finally figured out that EXCEL.EXE was
still running (in task manager), and if I tried to load another grid
from an Excel file I'd get errors. For example, I had several
formatting commands that sometimes worked - but ONLY if I loaded that
grid FIRST.

Anyways, I am opening Excel, and asking for a file name, doing stuff,
then want to close via code in a sub when I'm done:

Set objExcel = CreateObject("Excel.Application")
Set objBook = objExcel.Workbooks.Add
Set objSheet = objExcel.Sheets(1)
< save as xxx

to close:

objExcel.DisplayAlerts = False

' objBook.Close(SaveChanges:=False) ' <-- ** or True **

ActiveWorkbook.Close False
ThisWorkbook.Close
objExcel.Close
objExcel.Quit

Set objExcel = Nothing
Set objSheet = Nothing
Set objBook = Nothing

Tyring all kinds of stuff - but EXCEL.EXE still in task manager! Any
ideas? Thanks!


--
Steven8R
------------------------------------------------------------------------
Steven8R's Profile: http://www.excelforum.com/member.php...o&userid=15483
View this thread: http://www.excelforum.com/showthread...hreadid=270640


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Excel Won't Unload...

Untested, but maybe...

objexcel.ActiveWorkbook.Close False
objexcel.ThisWorkbook.Close false

(fully qualified)

Steven8R wrote:

I have an app that has a couple grids. If I load either grid from an
Excel file, no matter what I've tried, Excel will close, but not
disappear from the task manager.

I was getting all kinds of strange errors; and sometimes my code
worked, sometimes it didn't. I finally figured out that EXCEL.EXE was
still running (in task manager), and if I tried to load another grid
from an Excel file I'd get errors. For example, I had several
formatting commands that sometimes worked - but ONLY if I loaded that
grid FIRST.

Anyways, I am opening Excel, and asking for a file name, doing stuff,
then want to close via code in a sub when I'm done:

Set objExcel = CreateObject("Excel.Application")
Set objBook = objExcel.Workbooks.Add
Set objSheet = objExcel.Sheets(1)
< save as xxx

to close:

objExcel.DisplayAlerts = False

' objBook.Close(SaveChanges:=False) ' <-- ** or True **

ActiveWorkbook.Close False
ThisWorkbook.Close
objExcel.Close
objExcel.Quit

Set objExcel = Nothing
Set objSheet = Nothing
Set objBook = Nothing

Tyring all kinds of stuff - but EXCEL.EXE still in task manager! Any
ideas? Thanks!

--
Steven8R
------------------------------------------------------------------------
Steven8R's Profile: http://www.excelforum.com/member.php...o&userid=15483
View this thread: http://www.excelforum.com/showthread...hreadid=270640


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default Excel Won't Unload...

Steven;
This will be of no help but may I ask what version you are running?
I ask because I have encountered the same problem in Word'03.
I was going to try it in '97 and 2k when I saw your post.

My apologies for the interruption, but I'm getting a headache!
--
Regards;
Rob
------------------------------------------------------------------------
"Steven8R" wrote in message
...

I have an app that has a couple grids. If I load either grid from an
Excel file, no matter what I've tried, Excel will close, but not
disappear from the task manager.

I was getting all kinds of strange errors; and sometimes my code
worked, sometimes it didn't. I finally figured out that EXCEL.EXE was
still running (in task manager), and if I tried to load another grid
from an Excel file I'd get errors. For example, I had several
formatting commands that sometimes worked - but ONLY if I loaded that
grid FIRST.

Anyways, I am opening Excel, and asking for a file name, doing stuff,
then want to close via code in a sub when I'm done:

Set objExcel = CreateObject("Excel.Application")
Set objBook = objExcel.Workbooks.Add
Set objSheet = objExcel.Sheets(1)
< save as xxx

to close:

objExcel.DisplayAlerts = False

' objBook.Close(SaveChanges:=False) ' <-- ** or True **

ActiveWorkbook.Close False
ThisWorkbook.Close
objExcel.Close
objExcel.Quit

Set objExcel = Nothing
Set objSheet = Nothing
Set objBook = Nothing

Tyring all kinds of stuff - but EXCEL.EXE still in task manager! Any
ideas? Thanks!


--
Steven8R
----------------------------------------------------------------------

--
Steven8R's Profile:

http://www.excelforum.com/member.php...o&userid=15483
View this thread:

http://www.excelforum.com/showthread...hreadid=270640



Reply
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
How do I remove (not unload) a user installed Excel add-in ? bill h Excel Discussion (Misc queries) 1 March 1st 10 09:16 PM
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene LunaMoon Excel Discussion (Misc queries) 0 July 28th 08 11:03 PM
How to unload a form in excel vba? Edward[_7_] Excel Programming 2 September 30th 04 04:39 PM
Unload Me Chip Pearson Excel Programming 0 September 5th 03 12:56 AM
Form Unload Khai[_2_] Excel Programming 0 August 4th 03 09:28 PM


All times are GMT +1. The time now is 08:17 PM.

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"