+ Reply to Thread
Results 1 to 6 of 6

Run VBScript, with arguments, from VBA

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    59

    Run VBScript, with arguments, from VBA

    Hi folks,
    There is a script that I run in CMD, that exports a text file to a folder. I would like to run the process from VBA, and systematically tell Excel to proceed with the rest of the VBA code until after the script has finish running. Is this possible?

    The script format is:
    cscript \C:\folder\scriptExample.vbs "OU Location" >>test.txt

    OU Location is the org unit where data is pulled from & test.txt is the text file that is created with the data.


    So far I've been able to put this together..I just do not know how to include arguments.

    Please Login or Register  to view this content.

    Thank you!
    Last edited by amar05; 01-22-2016 at 10:07 AM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Run VBScript, with arguments, from VBA

    Hi there,

    Does the following line do what you need:

    Please Login or Register  to view this content.
    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    08-30-2012
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Run VBScript, with arguments, from VBA

    Hi Greg,
    Pardon my ignorance, but how do I integrate the OU location and the file where to export the data?

    Thank you.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Run VBScript, with arguments, from VBA

    maybe
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Registered User
    Join Date
    08-30-2012
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Run VBScript, with arguments, from VBA

    Hi,
    It accepted the OU location, but the data is output to the screen, in a window, instead of being written to the text file.


    Regards.

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Run VBScript, with arguments, from VBA

    Hi again,

    Sorry for the delay in getting back to you.

    In your statement:

    Please Login or Register  to view this content.
    you're using the >> characters to redirect the program output to a text file. Those characters are used for redirecting the output of batch (.bat) file programs, but I'm not sure if they can be used for redirecting the output of .vbs files.


    Hope this helps.

    Regards,

    Greg M

+ 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. [SOLVED] Help in VBScript....
    By abhijit2610 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2016, 02:18 PM
  2. [SOLVED] Converting VBA to VBScript
    By dlow in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2015, 10:18 PM
  3. Macro in VBScript
    By pushpita in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-02-2014, 02:54 AM
  4. CSV/XLS via VBScript
    By Leonidars in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-13-2012, 08:24 AM
  5. Vbscript to create VBA?
    By Jimbeau in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-02-2008, 03:49 PM
  6. Please help with ADO and VBScript!
    By jenhu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2006, 01:10 PM
  7. [SOLVED] Excel & VBScript
    By Bill Ebbing in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-08-2005, 02:05 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