Convert .bat file to VBA
Posted on 2014-11-30
Hi, I have a batch file which creates a single text file from many, and appends the file name as the first line in each text file (before combining them as one). I can then extract all data in a single pass, but I really need to run it in VBA, passing the text file location to the string as a variable. This is what I have now:
FOR /f "tokens=*" %%a IN ('DIR /b /a-d "*.txt"') DO (
TYPE "%%a" >>"TempFile.txt"
REN "TempFile.txt" "%%a"
copy *.txt Combined.txt
Currently I run it from inside the text file folder, but I want to pass that location, and the output location as a string variable, allowing me to have the text files in alternative locations, and set within a table called tblFolder_Locations.