I'm hoping that someone will know of a utility that will save me doing this manually for the next many years! useful Perhaps I should clarify the situation and what I am trying to achieve.I have several folder trees each containing many sub-folders, say A, B, C, D and so on.But read the Tips below the macro if you not get the result you want. Open Text Filename:=TXTFile Name, Origin:=xl Windows, Start Row _ :=1, Data Type:=xl Delimited, Text Qualifier:=xl Double Quote, _ Consecutive Delimiter:=False, Tab:=False, Semicolon:=False, Comma:=True, _ Space:=False, Other:=False Set Wb = Active Workbook Application. Save As Filename:=XLSFile Name, File Format:=File Format Num Application. Close savechanges:=False Msg Box "You find the Excel file here: " & vb New Line & XLSFile Name This example change the format of column 1 and 3 (column number, format number)This are the format numbers 1: General2: Text3: Month-Day-Year4: Day-Month-Year5: Year-Month-Day6: Month-Year-Day7: Day-Year-Month8: Year-Day-Month9: Skip column Replace If you use it for txt files then you can change the delimiter or maybe you want to use Fixed Width.Option Explicit #If VBA7 Then Private Declare Ptr Safe Function Open Process Lib "kernel32" _ (By Val dw Desired Access As Long, _ By Val b Inherit Handle As Long, _ By Val dw Process Id As Long) As Long Private Declare Ptr Safe Function Get Exit Code Process Lib "kernel32" _ (By Val h Process As Long, _ lp Exit Code As Long) As Long #Else Private Declare Function Open Process Lib "kernel32" _ (By Val dw Desired Access As Long, _ By Val b Inherit Handle As Long, _ By Val dw Process Id As Long) As Long Private Declare Function Get Exit Code Process Lib "kernel32" _ (By Val h Process As Long, _ lp Exit Code As Long) As Long #End If Public Const PROCESS_QUERY_INFORMATION = &H400 Public Const STILL_ACTIVE = &H103 Public Sub Shell And Wait(By Val Path Name As String, Optional Window State) Dim h Prog As Long Dim h Process As Long, Exit Code As Long 'fill in the missing parameter and execute the program If Is Missing(Window State) Then Window State = 1 h Prog = Shell(Path Name, Window State) 'h Prog is a "process ID under Win32. The best thing you can do is to record a macro when you import one txt file manual.Using a simple CMD command it is possible to combine all the CSV’s into a single entity ready for all your pivot and table wizardry. Make sure that the folder is free from any CSV’s you do not want included in the compression.

Each sub-folder contains many files, most of which are the same as those in other sub-folders of the same name.To get the process handle: h Process = Open Process(PROCESS_QUERY_INFORMATION, False, h Prog) Do 'populate Exitcode variable Get Exit Code Process h Process, Exit Code Do Events Loop While Exit Code = STILL_ACTIVE End Sub Sub Merge_CSV_Files() Dim Bat File Name As String Dim TXTFile Name As String Dim XLSFile Name As String Dim File Ext Str As String Dim File Format Num As Long Dim Def Path As String Dim Wb As Workbook Dim o App As Object Dim o Folder Dim foldername Set o App = Create Object("Shell. Browse For Folder(0, "Select folder with CSV files", 512) If Not o Folder Is Nothing Then foldername = o Folder. Then look at the recorded code and add the code lines to Workbooks. I have several sets of folder trees, each with multiple sub-folders, each sub-folder containing multiple files.There are a couple of different ways you can go about joining text files together and the results are slightly different depending on the method you choose.In this article, I’ll write about several ways to combine text files so that if one method doesn’t work out too well, you can try something else.into Excel.1) Open Excel2) When you use File Open to open the Text Import Wizard will help you import the file3) Choose Delimited4) Next5) Check Comma6) Finish This code will ask you to browse to the folder with the csv files and after you click OK in this dialogit merge all data into a txt file and then import and save it into a Excel file for you.Copy the code below into a normal module of a workbook : Alt-F11Insert Module Paste the macro Alt q to go back to Excel Alt F8 to open your macro list Select Merge_CSV_Files and press Run There is no need to change anything in the code example for csv files to test it.