Re: Clearing objects in a VBProject

From: VBA Dabbler (VBADabbler_at_discussions.microsoft.com)
Date: 02/09/05


Date: Wed, 9 Feb 2005 06:55:04 -0800

Tom,
Thanks for your perserverance - I am looking for the correct solution.

I didn't look closely enough to your response to notice that you were using
the 'xlApp' object in the 'Visible' and 'Workbooks.Open' commands.

Once I included it in both, the dangling instance of 'Excel.exe' as a
process in Task Manager properly clears.

Thanks so much for your help, Tom.

Regards,

VBA Dabbler

"Tom Ogilvy" wrote:

> It is obvious that you didn't try it, so apparently you not are looking for
> the correct solution.
>
> I tested your code and experienced the same problem - no surprise.
>
> I ran this code
> Sub TesterAA100()
> Dim xlApp As New Excel.Application
> Dim FileString As String
> FileString = "C:\MyDocuments\MyWorkbook.xls"
> xlApp.Application.Visible = True
> xlApp.Workbooks.Open (FileString) 'Focus is now on the workbook
> Set xlApp = Nothing
>
> End Sub
>
> and did not have the problem.
>
> If you want to reset then put the single statement
>
> END
> in your code. But that would be an ill advised solution.
>
> --
> Regards,
> Tom Ogilvy
>
> "VBA Dabbler" <VBADabbler@discussions.microsoft.com> wrote in message
> news:2AB1F69A-C5C2-46A2-BED7-436B6BB7CB4D@microsoft.com...
> > Tom,
> > Thanks for your response. I've already tried this and it does not clear
> the
> > process in TaskManager.
> >
> > Any other ideas?
> > Thanks,
> > VBA Dabbler
> >
> > "Tom Ogilvy" wrote:
> >
> > > Dim xlApp As Excel.Application
> > > Dim FileString As String
> > > FileString = "C:\MyDocuments\MyWorkbook.xls"
> > > xlApp.Application.Visible = True
> > > xlApp.Workbooks.Open (FileString) 'Focus is now on the
> workbook
> > > set xlapp = Nothing
> > >
> > > --
> > > Regards,
> > > Tom Ogilvy
> > >
> > > "VBA Dabbler" <VBADabbler@discussions.microsoft.com> wrote in message
> > > news:254AC0A1-CD46-4AA7-AC01-97C5774656E0@microsoft.com...
> > > > How do you clear an object from the VBProject once it has served its
> > > > usefulness?
> > > >
> > > > I've done the following:
> > > > 1. Opened a workbook from a Word VBProject with the following code:
> > > > Dim xlApp As Excel.Application
> > > > Dim FileString As String
> > > > FileString = "C:\MyDocuments\MyWorkbook.xls"
> > > > Excel.Application.Visible = True
> > > > Workbooks.Open (FileString) 'Focus is now on the workbook
> > > > 2. Closed workbook by closing Excel
> > > >
> > > > I've found that there is still an instance of the an object reference
> to
> > > the
> > > > Excel app - there is the "Excel.exe" process in the Windows
> Taskmanager.
> > > >
> > > > I've found that when I reset the VBProject where the above code
> resides,
> > > the
> > > > instance is cleared and the "Excel.exe" process in the Windows
> Taskmanager
> > > is
> > > > removed.
> > > >
> > > > Do you know how to selectively clear the instance of the object
> reference
> > > in
> > > > the VBProject?
> > > >
> > > > Thanks,
> > > >
> > > > VBA Dabbler
> > >
> > >
> > >
>
>
>



Relevant Pages

  • Re: Clearing objects in a VBProject
    ... the correct solution. ... "VBA Dabbler" wrote in message ... > "Tom Ogilvy" wrote: ... >>> How do you clear an object from the VBProject once it has served its ...
    (microsoft.public.excel.programming)
  • Re: memory leak (definition?)
    ... >> The correct solution is to understand the SW you are using and how to ... >> code than the code you are calling. ... to Gordon Burditt's response, is whether the exec family of functions ... such as the exec family are in fact relevant to the language and ...
    (comp.lang.c)
  • Re: The basics of Windows messages
    ... As mentioned in your response, if an application does not process ... and 1) to be the correct solution. ... add calls to ProcessMessages/DoEvents/PeekMessage loop inside your ...
    (microsoft.public.win32.programmer.kernel)
  • Re: The basics of Windows messages
    ... but I would like to add that most experienced developers consider 2) to ... and 1) to be the correct solution. ... The reason I focused my question on option 2) is that I wish to understand the execution flow from the point amid the lengthy process, where /ProcessMessages/ is called, to the queue processing, and then back to the calling site, where the lengthy process is resumed. ... William's response has already taken me much closer in that direction, but I think I might still need another round. ...
    (microsoft.public.win32.programmer.kernel)