SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Apr 2008
    Location
    Pune
    Posts
    420
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Deleting Excel Sheet reference from Task Manager

    Can someone help me in Deleting Excel Sheet reference from Task Manager?

    I am creating an Excel Sheet object and then I am also closing it. But after looking into Task Manager/Process tab EXCEL .exe still appears.

    I am using following code for creating and opening an instance of EXCEL file
    Filepath = "C:\Documents and Settings\username\My Documents\CommonDB.xls"
    Set ExcelApp = CreateObject("Excel.Application")
    Set ExcelWB = MOExcelApp.Workbooks.Open(Filepath)

    I am using following code for closing an instance of EXCEL file
    ExcelApp.DisplayAlerts = False
    ExcelApp.QUIT
    Set ExcelApp = Nothing

    TIA
    Charanpreet

  2. #2
    Senior Member
    Join Date
    Jun 2002
    Location
    farmington hills, MI, US
    Posts
    713
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Deleting Excel Sheet reference from Task Manager

    You are not closing your ExcelWB object or setting it to Nothing.

  3. #3
    Member
    Join Date
    Apr 2008
    Location
    Pune
    Posts
    420
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Deleting Excel Sheet reference from Task Manager

    Hi,

    I have added following line in my code
    Set ExcelWB = Nothing

    Still Excel sheet instance is there in the task manager.
    Anything else that I can do to remove the instance of excel sheet from task manager.

    Cheers
    Charanpreet

  4. #4
    Senior Member
    Join Date
    Nov 2005
    Location
    Valley Forge, PA
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Deleting Excel Sheet reference from Task Manager

    Go into the Windows Management Interface, get the process IDs and terminate them.
    See the following example for notepad.
    Got this from MSDN and have been using it for over a year.

    Joe



    Sub Main()

    Dim QueryText As String
    Dim strComputer As String
    Dim executable As String

    executable = "Notepad.exe"
    strComputer = "."
    QueryText = "SELECT * FROM Win32_Process Where Name = " & "'" & executable & "'"

    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colProcessList = objWMIService.ExecQuery(QueryText)

    For Each objProcess In colProcessList
    objProcess.Terminate
    Next

    End Sub

  5. #5
    Senior Member
    Join Date
    Jun 2002
    Location
    farmington hills, MI, US
    Posts
    713
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Deleting Excel Sheet reference from Task Manager

    Close the workbook before setting the object to 'Nothing'. You did call 'Open', so you should also call 'Close'. You may need to take care of the "MOExcelApp" object you are using to open the Workbook as well.

    There is also a Terminate method for the TApp object in TPOSI.

  6. #6
    Member
    Join Date
    Apr 2008
    Location
    Pune
    Posts
    420
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Deleting Excel Sheet reference from Task Manager

    Thanks chiefwiggum and JCD123. Its working for me.

 

 

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 Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:49 PM.

Copyright BetaSoft Inc.