title: How can I return the file path of all files, within one folder? This is for Excel VBA
body: <p>I have code that will allow me to return the file name of all files in a single folder. However, I would like to modify it to query a folder and return all the <strong><em>file paths</em></strong> of a particular file extension. (In this case .run files)</p>
  
  <p>Any help would be appreciated! Thanks in advance. </p>
  
  <pre><code>        Option Explicit 
  
  Sub GetFileNames() 
  
  Dim xRow As Long 
  Dim xDirect$, xFname$, InitialFoldr$ 
  
  InitialFoldr$ = "G:\" '&lt;&lt;&lt; Startup folder to begin searching from
  
         With Application.FileDialog(msoFileDialogFolderPicker) 
           .InitialFileName = Application.DefaultFilePath &amp; "\" 
            .Title = "Please select a folder to list Files from" 
             .InitialFileName = InitialFoldr$ 
               .Show 
                If .SelectedItems.Count &lt;&gt; 0 Then 
                   xDirect$ = .SelectedItems(1) &amp; "\" 
                   xFname$ = Dir(xDirect$, 7) 
                    Do While xFname$ &lt;&gt; "" 
                    ActiveCell.Offset(xRow) = xFname$ 
                    xRow = xRow + 1 
                     xFname$ = Dir 
                Loop 
            End If 
         End With 
     End Sub 
  </code></pre>