Hi!

I don't know VB6 well.
I was given the task to debug some code (that someone else wrote) to find the reason why there remains an Excel.exe in the task manager, after the excel application that was started by this VB code was closed.

I can't upload all the code that deals with the Excel part. There is simply too much and one would get bogged down by it. However, I will try to explain and summarize what has been done, and what I see that could be possible problems.

First of all, I can't find a line such as
Code:
Dim objExcel as Excel.Application
(objExcel just being an example for a name)

The application just appears somehow, and is referenced as Application.
So Application.Quit is in the code, but it doesn't seem to work. If I put into the Immediate Window ?Application (while debugging) I still get Microsoft Excel as answer after the Quit statement.
If I say
Code:
Set Application = Nothing
I get a compile time error.

Code:
Set objExcelBook = Nothing
    Set objExcelSheet = Nothing
is in the code to close the book and sheet.

If I look at where the Excel.exe appears in die Task Manager while debugging, (that is, unless I call ?Application in the Immediate Window) it appears when these lines are run:
Code:
    Dim wkbNew                As Excel.Workbook
        
    intOrigNumSheets = Application.SheetsInNewWorkbook
How can the application just appear like that? I've read something about late binding, but I don't understand exactly how it works in this case.


So could anyone give me some advice?