title: VBA find the name of last folder
body: <p>How can I code a function in VBA that helps me to get the last folder(example: Thisfolder) before the file .</p>
  
  <pre><code>P:\Folder1\..\Thisfolder\Test.txt
  </code></pre>
  
  <p>I want to just extract : Thisfolder</p>