View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Hanging Instance of Excel


In addition to Jim Thomlinson's good advice, make sure that every
reference to an object is qualified. So...

row = xlSheet.Cells(Rows.Count, "A").End(xlUp).Row
should read
row = xlSheet.Cells(xlSheet.Rows.Count, "A").End( -4162).Row

xlSheet qualifies Rows.
Access will not recognize xlUp, so the numeric value is used.

Set each object to nothing when done with it.
Avoid the use of With statements.
Do not use ActiveSheet, ActiveCell, Selection etc. They aren't qualified.
Not qualifying objects can lead to orphan references and Excel's refusal to quit.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Terry"
wrote in message
I have been trying some of the posts here to help with this but no luck so
far. I have an access DB that open Excel, processes the sheets there and
then closes. I have an instance of Excel still running that is only
accessible through the task manager. I need to figure out what I am doing
wrong with the following code.

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

ExcelTab = "Q1-Insvc_Disc Data"
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Open("C:\temp\Video Churn

Report_v_2007_06_22", 0, False)
Set xlSheet = xlBook.Worksheets(ExcelTab)