Results 1 to 7 of 7

Deleting file obtained from VBA shell to Batch file

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Deleting file obtained from VBA shell to Batch file

    Hello everyone,

    I am trying to delete the batch file that's created during the process. Part of the code is as follows:
    Sub Batch
    Dim Batch_File As String
    Dim file_location As String
    Open file_location & "BatchFile.bat" For Output As #batch_file
    Print #batch_file, "cd " & file_location
    Close #batch_file
    Batch_File = Shell(file_location & "BatchFile.bat", vbMaximizedFocus)
    End Sub
    i need to delete the batch file (i.e. file_location & "BatchFile.bat") permanently once the tasks are processed.

    i am trying to use the code below to delete the batch file but it doesn't work for some reason
    Dim Batch_File_Delete As String
    Batch_File_Delete = Shell("del" & file_location & "BatchFile.bat", vbMinimizedNoFocus)
    any suggestion guys..

    thanks in advance guys!!

    best regards
    plasma33
    Last edited by plasma33; 12-28-2014 at 07:05 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. 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
  2. Replies: 0
    Last Post: 01-21-2014, 10:52 AM
  3. Problem using shell to call batch file or cmd prompt
    By nickf829 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2011, 10:27 PM
  4. [SOLVED] send parameters to a batch file with the shell command
    By Marcos in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2006, 03:00 PM
  5. getting vba shell command to execute batch and save output to a file
    By Mad Scientist Jr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2006, 10:10 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