Consulting

Results 1 to 2 of 2

Thread: Sleeper: Can I run an executable within my VBA?

  1. #1
    VBAX Expert
    Joined
    Aug 2007
    Location
    Windermere, FL, a 'burb in the greater Orlando metro area.
    Posts
    567
    Location

    Sleeper: Can I run an executable within my VBA?

    I run a process at work (an .exe) that extracts records from a database and creates a tab-separated text file of its records.

    Then, I run my vba program which opens the text file, does text to columns, reads the worksheet and adds a GUID to any record it finds without one, saves it back as tab-delimited text.

    Finally, I run the program again (with a different config file) and import the records, updating the database.

    Is there a way that can do all of this from inside my VBA program?

    I want to invoke the program from inside my VBA code, have my code wait until the exe completes, resume and run my GUID function, then, swap config files for the exe program, and invoke it one more time, pausing the VBA until the exe completes and then let the VBA wrap things up?

    Many Thanks in Advance.
    Ron
    Windermere, FL

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    You can use the wait method to pause Excel
    'Pause vba for 15 seconds
    Application.Wait now+timevalue("00:00:15")
    you can use this to open an .exe http://www.thecodecage.com/forumz/lo...id=2&linkid=21 and this to close http://www.thecodecage.com/forumz/lo...id=2&linkid=23
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

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