title: retrieve folder path from file path
body: <p>I am able to select the file from filedialog function and storing the file path in string. but I also want the folder name of the selected path. Can you please advise as to how to get the folder path from select file.</p>
  
  <p>File selected is : </p>
  
  <pre><code>U:\public\2016\Macro\CD-CW\109 file.xlsx
  </code></pre>
  
  <p>I want to show till : </p>
  
  <pre><code>U:\public\2016\Macro\CD-CW\
  </code></pre>
  
  <p><strong>My Code</strong></p>
  
  <pre><code>Dim fd As Office.FileDialog
  Set fd = Application.FileDialog(msoFileDialogFilePicker)
  With fd
      .AllowMultiSelect = False
      .Title = "Please select the file."
      .Filters.Clear
      .Filters.Add "Excel 2010", "*.xlsx"
      .Filters.Add "All Files", "*.*"
      If .Show = True Then
          selfile = .SelectedItems(1) 'replace txtFileName with your textbox
      End If
  End With
  </code></pre>