LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Clearing objects in a VBProject

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" wrote in message
...
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" wrote in message
...
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








 
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
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Unprotecting the VBProject jstrater Excel Programming 4 May 16th 04 04:01 PM
Documentation for VBProject Wes Jester Excel Programming 2 September 30th 03 06:26 PM
VBProject events? Marc R. Bertrand Excel Programming 1 September 14th 03 04:12 PM
VBProject events? Chip Pearson Excel Programming 0 September 10th 03 10:36 AM


All times are GMT +1. The time now is 12:07 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"