Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Feb 2003
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parent Directory (2000)

    How do I reference in vba the parent directory to ThisWorkbook?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Parent Directory (2000)

    If you want the folder in which ThisWorkbook resides: ThisWorkbook.Path.
    If you want the parent of that folder, you can find the position of the last in ThisWorkbook.Path using InStrRev, and take everything to the left of it, or use
    CreateObject("Scripting.FileSystemObject").GetFold er(ThisWorkbook.Path).ParentFolder.Path

  3. #3
    3 Star Lounger
    Join Date
    Feb 2003
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Parent Directory (2000)

    Thanks. The last part is what I wanted

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Parent Directory (2000)

    In addition to what Hans said, another way is:

    <pre> ThisWorkbook.Path & ".."
    </pre>

    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •