+ Reply to Thread
Results 1 to 5 of 5

VBA to command prompt - sending multiple commands to same line?

Hybrid View

  1. #1
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    VBA to command prompt - sending multiple commands to same line?

    Good day all... hoping for a little help with the syntax on this one. An associate of mine created a phenomenal mini application in Python, which we can run from a command prompt manually. I'm trying to integrate his application into a spreadsheet our group has been using for quite some time now.

    Other than opening a dos prompt and doing a "pushd" to map a network drive, I got nothing. And nothing I'm doing is working. And nothing I've read is helping.

    I don't think this should be terribly difficult, but... well, for me it is.

    I'm trying to do the following:
    From VBA, open the Command window, which seems to work with
    VBA.Shell "C:\WINDOWS\system32\cmd.exe"
    - Once the DOS window is open, I need to change directories to, something like
    "\\Corp.Bloomberg.com\Pn-dfs\q_search\"

    - I need to then execute this line
    "q_search.exe small_set.txt"

    - Wait until the dataset is loaded (small_set.txt)

    From here the script allows some user input, which it then processes (n-gram string searches done via Python), then outputs the data to a file, which I will import back into my spreadsheet.

    Hope that makes sense - and thank you for any help!

    JP
    Last edited by JP Romano; 02-07-2012 at 10:43 AM.

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VBA to command prompt - sending multiple commands to same line?

    You can use Shell but it will run asynchronously so the rest of your code will not wait for it to finish - is that an issue?
    Good luck.

  3. #3
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: VBA to command prompt - sending multiple commands to same line?

    First of all, great UserName...
    No, it's not an issue - thanks for asking... and for any help.

    JP

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VBA to command prompt - sending multiple commands to same line?

    Untested as I am on the road currently, so using my cell, but something like
    shell "cmd.exe /c \\Corp.Bloomberg.com\Pn-dfs\q_search\q_search.exe \\Corp.Bloomberg.com\Pn-dfs\q_search\small_set.txt"

  5. #5
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: VBA to command prompt - sending multiple commands to same line?

    So sorry for the delayed response - been out sick for a couple of days and am just getting back to my projects.
    Thank you so much for the solution!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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