I tried to run a batch file using shell command. my code is as below. it throws an error run time error:5, invalid procedure call and on debut it points out the shell command line. pl clarify and solve the problem.
My code to run the batch file.
merge.bat file is created but don't run thro shell command. if i double click the batch file it rund perfectly
pl help
R Ravisankar
My code to run the batch file.
Code:
Dim path As String path = ActiveWorkbook.path Dim retVal, A, fs Dim coln As String coln = Mid(path, 1, 1) Set fs = CreateObject("Scripting.FileSystemObject") Set A = fs.CreateTextFile(path & "\" & "merge.bat", True) A.writeline "@echo off" A.writeline coln & ":" A.writeline "cd " & path & "\" A.writeline "del tdslist.txt" A.writeline "del tdsrefund.txt" A.writeline "copy *.txt tds.txt" A.Close retVal = Shell(path & "\" & "merge.bat", 1)
pl help
R Ravisankar
Comment