+ Reply to Thread
Results 1 to 9 of 9

Kill a Process

  1. #1
    Registered User
    Join Date
    10-02-2017
    Location
    Huntsville, Alabama
    MS-Off Ver
    2010
    Posts
    57

    Kill a Process

    So..ok, I started a program with the shell command which returns the process ID number. How do you close the process using that ID number?

    TIA
    Grug

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Kill a Process

    Hi this was posted at stackoverflow:
    https://stackoverflow.com/questions/...rough-vba-code
    Maybe it can help you
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    10-02-2017
    Location
    Huntsville, Alabama
    MS-Off Ver
    2010
    Posts
    57

    Re: Kill a Process

    I do wonder from the two examples if they are Windoze version specific or subject to change, but I'm guessing the process ID number returned is of no use to VBA then?

    I think what you found is great starting point however --- thanks @Keebellah

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Kill a Process

    The command to kill is the following:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-02-2017
    Location
    Huntsville, Alabama
    MS-Off Ver
    2010
    Posts
    57

    Re: Kill a Process

    VBA help (F1):

    Please Login or Register  to view this content.
    It seems odd Excel VBA returns a process ID from the shell command and it isn't used (by VBA). However, I've never considered Excel (or anything else under the micro$oft name) to be a finished product...

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Kill a Process

    What makes you say that? What process ID? IS it active?
    Have you checked under de dos command prompt?
    You're using one application to do something entirely different that what it's intended for.
    Finished product?
    IS your family car not an unfinished product because you cannot make it plow a cornfield?

  7. #7
    Registered User
    Join Date
    10-02-2017
    Location
    Huntsville, Alabama
    MS-Off Ver
    2010
    Posts
    57

    Re: Kill a Process

    Well, like I said, your previous solution looked entirely workable

    You're using one application to do something entirely different that what it's intended for.
    This is arguable, but also an "in the eye of the beholder" thing. At face value, lets just say that if you can show me a native VBA command using the returned value of the shell command (other than non-zero which could have been implemented by micro$oft as a Boolean return value), and I'll concede I've made my previous "assertion" under false premise?

    Thanks again,
    Grug

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Kill a Process

    Hi Grug,
    Playing around a little, this code will retrieve the running tasks and list them in a file named PROCESSES.txt in your temp folder
    Please Login or Register  to view this content.
    You can use the output in for example a listbox to select the task you want to kill.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,640

    Re: Kill a Process

    This thread has been marked as solved, but also reported as having gone off topic.

    Steve - if there is something further you wish to know that hasn't been addressed by Keebellah, then please state it clearly here so that someone else can take a look and advise. I confess from reading the thread, I am not sure what that is, so you will need to provide clarification if you need further help.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Kill a second Excel process from the first excel process
    By sebair in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2012, 05:40 PM
  2. help!kill process excel.exe
    By xz739 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2006, 04:30 AM
  3. Kill a process - Could someone check this code for me
    By ina in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2006, 09:10 AM
  4. Kill
    By Michael in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2005, 07:05 AM
  5. [SOLVED] How? Granting elevated privileges to a web service / kill a process
    By Lee Gillie in forum Excel General
    Replies: 1
    Last Post: 05-13-2005, 01:06 PM
  6. Kill Excel Process
    By Mike Moore in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-17-2005, 05:06 AM
  7. [SOLVED] How to count process running time ( process not finished)
    By miao jie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2005, 06:06 AM
  8. [SOLVED] How to count process running time ( process not finished)
    By miao jie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2005, 02:06 AM

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