title: How to get the last modified file in a directory using VBA in Excel 2010
body: <p>Im looking for a way to do this in Excel 2010 using VBA.</p>
  
  <p>It used to be possible in Excel 2003 using the Application.FileSearch method, but this has be depreciated. (see below)</p>
  
  <pre><code>Dim sFileName As String
  
  sFileName = ""
  With Application.FileSearch
      .NewSearch
      .LookIn = sDir
      .Filename = "*.*"
      .Execute msoSortByLastModified, msoSortOrderDescending
  
      If .FoundFiles.Count &gt; 0 Then sFileName = .FoundFiles(1)
  
  End With
  </code></pre>
  
  <p>Any ideas how to do this in Excel 2010?</p>
  
  <p>Thanks</p>