Re: Closing Excel from Access Macro

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

anonymous_at_discussions.microsoft.com
Date: 02/11/04


Date: Wed, 11 Feb 2004 11:50:41 -0800

Many thanks - I am going to be testing it this afternoon...

>-----Original Message-----
>Here's a little code snippet I tested with:
>
> Dim o As Object
> Set o = CreateObject("Excel.Application")
> MsgBox o
> MsgBox "Test Me"
> o.Quit
> Set o = Nothing
>
>when the "test me" msgbox is open, you can launch task
manager and see
>Excel.exe running. Then, once you hit ok and the code
completes, you will
>see in task manager that the excel instance has
dissapeared.
>What you were probably doing before was launching a new
Excel process (this
>won't show up in the Applications section of the task
manager because you
>launched it through another process without a main
window, but it does show
>up in the processes section as you discovered), and then
closing Access
>without quiting the excel process. Since the Excel.exe
instance is its own
>process and not a child object of the Access process, it
remained alive even
>after you closed Access.
>--
>Bryan Reich
>Microsoft Office
>--
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>Use of any included script samples are subject to the
terms specified at
>http://www.microsoft.com/info/cpyright.htm
>
>
>"ChrisBat" <anonymous@discussions.microsoft.com> wrote in
message
>news:d5ef01c3ef46$f6f38710$a401280a@phx.gbl...
>> Hi,
>>
>> I have a macro that is operated by a button on a form.
In
>> brief, this macro is supposed to download a dataset from
>> an intranet page (in Excel), clean and manipulate the
>> data, resave the spread***, and then close Excel,
>> returning back to the Access form that was used to open
>> the original spread***.
>> I am having a couple of problems:
>> (1) The code runs fine for a couple of times, but after
a
>> while, when I try and delete the spread***, it says
that
>> the file is still open; this is not possible, because it
>> is on my desktop, MS Access has also closed (see below)
>> and there is no indication of Excel being open when I go
>> into task manager. HOWEVER, what is open (according to
>> the Processes tab) is excel.exe and agentsvr.exe. Once
I
>> close these, I can delete the spread*** without a
>> problem. How do I stop this from continuing?
>> (2) The macro also closes Access instead of just excel -
>> any ideas how I can close one and keep the other open?
>> Any help would be appreciated.
>> Thanks for your time,
>> Chris
>
>
>.
>


Quantcast