+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    10-02-2008
    Location
    Kensington, CA
    Posts
    26

    Acessing Starting Folder Path

    I start an Excel program from a shortcut in different folders. I know that I can find the path of the Excel program in "Parent.Path". But I don't know how to find the path of the folder the shortcut was in. It should be findable because when I try to do something like <Save>, Excel knows the correct folder there.

    An example: I open Excel in "Folder 1" using a shortcut to the Excel Program in "Folder 2". Parent.Path tells me "Folder 2". How do I find out what "Folder 1" is from inside Excel?

    Thanks,

    Mac in Berkeley, CA

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,494
    Hello CaptMac,

    Welocme to the Forum!

    If I understand you correctly, you referring to a workbook and not the Excel application. The following code will return the full directory path for the workbook.
    Code:
      ThisWorkbook.Path
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    10-02-2008
    Location
    Kensington, CA
    Posts
    26

    Response to "Accessing Starting Folder Path"

    Thanks, Leith, for the response.

    With regards to my original example

    ThisWorkbook.Path yields the path to the folder the workbook is in: ie. /../Folder2.

    What I'm looking for is something that yields the path to the folder the shortcut was in: ie. /../Folder 1.

    Mac

  4. #4
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,445
    Does this work

    Code:
    MsgBox CurDir()
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  5. #5
    Registered User
    Join Date
    10-02-2008
    Location
    Kensington, CA
    Posts
    26
    Thanks, RoyUK, for the reply. But...

    CurDir() gives me a pointer to my home directory, not to /../ Folder1
    when I tried it in my code.

    Mac

  6. #6
    Registered User
    Join Date
    10-02-2008
    Location
    Kensington, CA
    Posts
    26

    Solved

    It turns out that what I thought might work does NOT.

    The only reference to external files is the WorkBook.Parent. SO that's all one can find out.

    Captn Mac

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Trying to move all xls files from one folder to another
    By oakman in forum Excel Programming
    Replies: 1
    Last Post: 09-11-2008, 11:39 AM
  2. Copy and Paste Folder With VBA
    By cjconnor24 in forum Excel Programming
    Replies: 5
    Last Post: 07-08-2008, 05:47 AM
  3. Cell is equal to a folder name up 3 levels of the path
    By crumpet in forum Excel Worksheet Functions
    Replies: 0
    Last Post: 07-26-2007, 01:28 AM
  4. Folder Path.
    By gajendra.gupta in forum Excel Programming
    Replies: 3
    Last Post: 01-31-2007, 04:11 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0