title: Move zipped files from multiple subfolders into one master folder via loop process
body: <p>I am trying to:</p>
  
  <p>First Prompt: Ask the user to select the folder that contains all zipped folders where each zipped folder contains a data file.</p>
  
  <p>Second Prompt: Ask the user to select the master folder path to place the unzipped data files. </p>
  
  <p>The program will unzip the first zipped folder, copy the data file, paste the data file into the designated master folder the user was prompted to select from their second prompt.</p>
  
  <p>The program will find the next zipped folder, unzip and open the folder, copy the file it contains, paste the file into the master folder, repeat until all the files from each of the zipped folders are moved.</p>
  
  <p>I am trying to make a folder that contains all the zipped data files in order to concatenate all the data into a master document. Then I will run an analysis on this data.</p>
  
  <p>This code works on folders that are not zipped. I need the code to recognize zipped folders and the "*.csv" file each zipped folder contains.</p>
  
  <pre><code>Option Explicit
  Public FolderPath As FileDialog
  
  'This program copies files from multiple folder locations into one folder location.
  
  Sub CopyFiles()
  
  Dim objFSO As Object 'FileSystemObject
  Dim objFile As Object 'File
  Dim objFolder As Object 'Folder
  Dim strFolder As String
  Dim strNewFolder As String
  
  'Optimize Macro Speed
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  Application.Calculation = xlCalculationManual
  Application.DisplayAlerts = False
  
  'Retrieve target master workbook data folder path from user
  Set FolderPath = Application.FileDialog(msoFileDialogFolderPicker)
  
  With FolderPath
      .Title = "Select a master folder location to store the unzipped files."
      .AllowMultiSelect = False
      If .Show &lt;&gt; -1 Then GoTo CancelSelect1
      strNewFolder = .SelectedItems(1) &amp; "\"
  End With
  
  'In case Cancel selected
  CancelSelect1:
  strNewFolder = strNewFolder
  If strNewFolder = "" Then GoTo ResetSettings
  
  'Retrieve target data folder path from user
  Set FolderPath = Application.FileDialog(msoFileDialogFolderPicker)
  
  With FolderPath
      .Title = "Select folder location that contains the zipped folders with desired data files."
      .AllowMultiSelect = False
      If .Show &lt;&gt; -1 Then GoTo CancelSelect2
      strFolder = .SelectedItems(1) &amp; "\"
  End With
  
  'In case Cancel selected
  CancelSelect2:
  strFolder = strFolder
  If strFolder = "" Then GoTo ResetSettings
  
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  For Each objFolder In objFSO.GetFolder(strFolder &amp; "\").SubFolders
  'If Right(objFolder.Name, 2) = "tb" Then
      For Each objFile In objFolder.Files
          'If InStr(1, objFile.Type, "Excel", vbTextCompare) Then
              On Error Resume Next
              Kill strNewFolder &amp; "\" &amp; objFile.Name
              Err.Clear: On Error GoTo 0
  
              Name objFile.Path As strNewFolder &amp; "\" &amp; objFile.Name
          'End If
      Next objFile
  'End If
  Next objFolder
  
  'Reset Macro Optimization Settings
  ResetSettings:
  Application.EnableEvents = True
  Application.Calculation = xlCalculationAutomatic
  Application.ScreenUpdating = True
  Application.DisplayAlerts = True
  
  'Message Box when tasks are completed
  MsgBox "Task Complete!"
  Application.Cursor = xlDefault
  
  End Sub
  </code></pre>