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

    Where was my excel program started from?

    I start my excel program from a "Shortcut" in "Folder 1".
    That shortcut points an Excel program in "Folder 2".

    When Excel is started,
    Parent.Path returns "Folder 2",
    but I really need to know what "Folder 1" was.

    It seems that should be available as
    when I do "Save File As"
    it is pointing to "Folder 1".
    Is there a way to find what "Folder 1" really was from the VBA enviornment.

    Thanks for the help,
    Mac
    Last edited by CaptMac; 10-23-2008 at 02:02 PM. Reason: Got my answer

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Cochrane,Alberta
    MS-Off Ver
    XL 2003,2007
    Posts
    6,259
    Not understanding the question completely...
    you can use a formula to get the file path of a saved workbook.....
    =CELL("filename",A1)
    place it in a cell exactly how it is written.
    Dave


  3. #3
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,137
    I don't think you're going to find Folder 1 unless you can find something akin to a call stack in Windows API.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

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

    What about the "File Save" pointer?

    In Excel, when I open <File>, <Save As>
    it points to "Folder 1".

    Is there any way in VBA of accessing this information?

    Mac

  5. #5
    Valued Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    291
    can you not go up a level in the directory structure in the save-as dialog box?

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

    Reply to "Going Up a Level"

    I'm not trying to "go up a level".

    What I want to get in VBA is the path to directory that is displayed when I do <File>, <Save As>.

    And this is not what is displayed in "Parent.Path".

    Mac

  7. #7
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,137
    I start my excel program from a "Shortcut" in "Folder 1" that points an Excel program in "Folder 2". When Excel is started, Parent.Path returns "Folder 2", but I really need to know what "Folder 1" was.

    It seems that should be available as when I do "Save File As" it is pointing to "Folder 1".
    When you say 'Excel program', I'm assuming you mean a workbook.

    When I do that, the default SaveAs path is "Folder 2".
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

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

    Reply

    Yes, I mean opening a workbook in Excel that I also execute VBA programs in.

    Mac

  9. #9
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,137
    Right.

    Well, as I said, the default saveas path for me is the directory the workbook is in, not the directory containing the shortcut from which it was opened.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

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

    The shortcut only contains information about the Target, the file to be opened. It contains the full path of file and an auxillary folder path for files the program may require. It does not contain any information about its own location. It is not possible to back track from the program to the shortcut using either VBA or the API.

    Sincerely,
    Leith Ross

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel crashes due to incomplete VBA compilation?
    By RogerN in forum Excel Programming
    Replies: 2
    Last Post: 06-11-2009, 10:26 PM
  2. Importing Excel worksheet into Word
    By mark87 in forum Excel General
    Replies: 0
    Last Post: 09-08-2008, 01:20 PM
  3. Replies: 5
    Last Post: 02-23-2008, 04:24 PM
  4. Replies: 0
    Last Post: 05-04-2007, 11:08 PM
  5. Copying data from another program into Excel as numbers
    By wmjenner in forum Excel Worksheet Functions
    Replies: 2
    Last Post: 01-17-2007, 02:04 PM

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