+ Reply to Thread
Results 1 to 2 of 2

Calling Batch File from VBA

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    15

    Calling Batch File from VBA

    Hello.. the following code runs a batch file.. it works but it prompts to "RUN" the file.. Is there a way to bypass the "RUN" prompt?

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Calling Batch File from VBA

    cant you add that functionality to the batch file?
    When we used to run or build batch files, there was a command you could add to the actual batch or even part of the path to prevent that prompt.


    You can use the Arguments property to pass command line parameters:

    WshShell.Run chr(34) & “C:\Batch Files\syncfiles.bat” & Chr(34) & WScript.Arguments(0), 0

    I found it useful to verify the command string before putting it into the script:

    WScript.Echo chr(34) & “C:\Batch Files\syncfiles.bat” & Chr(34) & WScript.Arguments(0)
    Last edited by cubangt; 04-30-2021 at 02:23 PM.

+ 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. need to clear contents of an excel file using command prompt or a batch file
    By ananthblaze in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-29-2020, 03:17 PM
  2. Need macro that opens .txt file in excel, run macros and save file in batch
    By khalidness in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2014, 11:00 AM
  3. [SOLVED] Open online excel file - batch file
    By no_Fate in forum Excel General
    Replies: 2
    Last Post: 07-10-2014, 05:36 PM
  4. Replies: 0
    Last Post: 01-21-2014, 10:52 AM
  5. Batch file & macro to copy the latest file from a folder
    By paidlukkha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-19-2013, 03:05 PM
  6. Batch file to open the most recent excel file
    By rajasekhar28 in forum Excel General
    Replies: 2
    Last Post: 12-30-2009, 08:00 AM
  7. [SOLVED] Would Like to Automate Batch File Creation and Text FIle Import
    By socrtwo in forum Excel General
    Replies: 2
    Last Post: 08-18-2006, 11:00 AM

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