Results 1 to 4 of 4

Phantom Excel.EXE Process

Threaded View

  1. #1
    Registered User
    Join Date
    02-19-2008
    Posts
    1

    Phantom Excel.EXE Process

    Hi,
    I have an Excel file with user controls. The controls include a couple of drop-down boxes and a button.

    The user makes some selections, then clicks the button. The VBA code in the Click event of the button creates a new Excel.Sheet object as follows:
    Dim objExcel As Object
    
    Set objExcel = CreateObject("Excel.Sheet")
    This is late binding I guess.


    It does some data populating using ADO & formatting with this newly created object and then saves it.

    At the end of the code, I am closing this object and also setting all the objects to Nothing .

    Once everything is done running, I close the generated excel file and also the main file (which I call the 'User Options' file). I close all instances of Excel. For some reason, there is an EXCEL.EXE process still running in Task Manager. My first guess was that there was memory leak in the code. I have checked the code thoroughly and have not found any leaks.


    Here is the code, in general.

    Dim ExcelSheet As Object
    Set ExcelSheet = CreateObject("Excel.Sheet")
    
    
    strConnect = "......"
    
    Dim rsData As New ADODB.Recordset
    
    SQL = "......"
    
    
    rsData.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText
        
    
    Sheets(1).Range("B4").CopyFromRecordset rsData
            
    
    rsData.Close
    Set rsData = Nothing
    
    ExcelSheet.SaveAs(fileName)
    
    ExcelSheet.Close
    
    Set ExcelSheet = Nothing

    Can someone please help me figure out why it is leaving the Excel Process running, and what I can do about it?


    Thanks.



    Saad
    Last edited by royUK; 02-19-2008 at 11:59 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1