+ Reply to Thread
Results 1 to 3 of 3

Open EXE and upon close, record running time to text file (Advanced VBA question)

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Open EXE and upon close, record running time to text file (Advanced VBA question)

    I am tinkering with a hobby project. I have it all planned out with only one item that I am not sure how to do.

    I want VBA to open an executable. After the process ends (regardless whether it finished running, the end user closed or if the program crashed), the running time is recorded to an external file.

    I know how to make VBA run a program. I know how to make VBA write data to a text based file. It's detecting the program end that I'm having trouble with.

    I don't care what method is used to determine the program end. (It doesn't need to be Excel/VBA that determines that the exe has ended.) As long as the running time is written and the means is not resource intensive (e.g. I wouldn't want to continually loop VBA checking the process existence)

    I have recently read about WaitForSingleObject but I'm not sure if this is what I should be looking into?

    Re accuracy level - The running time doesn't have to be millisecond accurate. I will be recording running time in seconds. Up to 2 seconds variance is acceptable.

    Re environment - Excel 2010 32 bit installed in Windows XP 32 bit
    Last edited by mc84excel; 10-20-2019 at 10:06 PM.
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Open EXE and upon close, record running time to text file (Advanced VBA question)

    .
    https://docs.microsoft.com/en-us/off...d-process-ends

  3. #3
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Open EXE and upon close, record running time to text file (Advanced VBA question)

    Thanks Logit. That's the page I was referring to in "I have recently read about WaitForSingleObject but I'm not sure if this is what I should be looking into?"

    Have you used this feature yourself? How well does it work? Any pros and cons to consider?

+ 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. File with data of open and close date and time
    By Shreyans Nahata in forum Excel General
    Replies: 2
    Last Post: 01-12-2015, 05:44 AM
  2. How to Assign more than one User name and Password & how to record File open and close
    By Nisar.mohammed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-13-2014, 11:37 AM
  3. [SOLVED] VBA code to open many files, copy text, close file, paste text in second work
    By Bikeman in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 02-11-2014, 12:59 PM
  4. Replies: 13
    Last Post: 11-29-2012, 08:25 PM
  5. looping, Open text file, copy text, close text file
    By jwilds1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2009, 05:12 PM
  6. Open and Close Excel / Time Running
    By tchristie33 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2007, 09:13 PM
  7. Close & save a file at set time only IF the file is open
    By Clivey_UK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2006, 01:19 PM

Tags for this Thread

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