Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 4 of 4

Thread: Shell Command In Vba

  1. #1
    Join Date
    4th February 2007
    Posts
    21

    Shell Command In Vba

    Hi ,

    I have to run command prompt from with my VBA code , and run an application passing it 2 filenames and redirecting the output of the application to a third file. Also my VBA script should wait for the application to complete running before getting back to the next line of execution. HEre is what i have coded so far :

    VB:
    Sub Macro1() 
         
        Dim dosCmd As String 
         
        dosCmd = "purge.exe  input1.txt input2.txt >> opFile.txt" 
         
        Call Shell("cmd.exe " & dosCmd, vbNormalFocus) 
    
    
    Now this code ends up just opening the command prompt and nothing else. It does not run purge.exe. Can someone guide me on this please ?

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    19th January 2005
    Location
    Michigan, USA
    Posts
    844

    Re: Shell Command In Vba

    I use to execute an external file that populates files; once the final file is created it continues with everything else...

    VB:
    Sub ScriptExport() 
        Dim RetVal 
        RetVal = Shell("J:\AcctMgt\3N\WFM\Scripting\Scripts\AuxReports\AuxReports.bat", 1) 
        Call ScriptExportDone 
    End Sub 
    Sub ScriptExportDone() 
        Do Until Dir("J:\AcctMgt\3N\WFM\Scripting\Scripts\AuxReports\QWT\QWTBOYCEaux.xls") <> "": Loop 
            Call cchr 
        End Sub 
    
    

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    4th February 2007
    Posts
    21

    Re: Shell Command In Vba

    when i try to use Shell it does not compile , i have to use call shell . Would anyone know why this is the case ?

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    24th May 2010
    Posts
    1
    ??

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Shell Command, Error Logging
    By Covenant in forum EXCEL HELP
    Replies: 5
    Last Post: April 6th, 2006, 10:31
  2. Opening file with shell() command
    By rmullen in forum Excel and/or Access Help
    Replies: 2
    Last Post: February 3rd, 2006, 01:49
  3. Shell Command
    By msklein in forum EXCEL HELP
    Replies: 6
    Last Post: October 25th, 2005, 08:08
  4. Using Windows search with shell command
    By Pacheco in forum EXCEL HELP
    Replies: 6
    Last Post: March 20th, 2005, 10:30
  5. error with shell command
    By ljoseph in forum EXCEL HELP
    Replies: 2
    Last Post: December 23rd, 2004, 05:51

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
  •  
porno