View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
terry terry is offline
external usenet poster
 
Posts: 193
Default Hanging Instance of Excel

Jim

I switched the lines around but I am still getting the hanging instance of
Excel in the Task Manager. I added some stripped down code that I am
processing against the sheet.

"Jim Thomlinson" wrote:

The order in which you destry the objects is important. Destroy the book
prior to the application... More like this...

xlBook.Close savechanges:=True
Set xlBook = Nothing
xlApp.Quit ' When you finish, use the Quit method to close
Set xlApp = Nothing ' the application, then release the reference.
--
HTH...

Jim Thomlinson


"Terry" wrote:

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)


row = xlSheet.Cells(Rows.Count, "A").End(xlUp).Row

Do While Row 1
If xlSheet.Cells(Row, 1).Value = FilterDate And xlSheet.Cells(Row,
4).Value = VideoComp Then
'MsgBox Row
Set BegRange = xlSheet.Cells(Row, 1)
Set EndRange = xlSheet.Cells(Row, 7)
xlSheet.Cells.Range(BegRange, EndRange).Delete (xlUp)
End If
Row = Row - 1
Loop


xlBook.Close savechanges:=True
xlApp.Quit ' When you finish, use the Quit method to close
Set xlApp = Nothing ' the application, then release the reference.
Set xlBook = Nothing


Thanks for your help all

Terry