How to get file's current directory path to a string in VBA?

Discussion in 'Microsoft Excel Programming' started by wenkej@nj.sc.mcel.mot.com, Oct 16, 2003.

  1. Guest

    In my VBA I needed to get some data from another Excel
    file located in the same directory with current host excel
    file.How could I got the current file's path ,something
    the same as "../" in UNIX?
    Thanks!
     
    , Oct 16, 2003
    #1
    1. Advertisements

  2. Harald Staff Guest

    Sub test()
    Dim sPath As String
    sPath = ActiveWorkbook.Path
    MsgBox sPath
    End Sub

    --
    HTH. Best wishes Harald
    Followup to newsgroup only please.

    "" <> wrote in message
    news:01a201c393af$4883e870$...
    > In my VBA I needed to get some data from another Excel
    > file located in the same directory with current host excel
    > file.How could I got the current file's path ,something
    > the same as "../" in UNIX?
    > Thanks!
     
    Harald Staff, Oct 16, 2003
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tegger

    get path - save new file - same sub-directory as existing file

    tegger, Oct 21, 2003, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    321
    Chip Pearson
    Oct 21, 2003
  2. Richy

    Set The Directory to the Current WB Path

    Richy, Feb 29, 2004, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    534
    Bob Phillips
    Feb 29, 2004
  3. unnameable

    changing current directory to that of the current open file

    unnameable, May 19, 2004, in forum: Microsoft Excel Programming
    Replies:
    2
    Views:
    705
    Cecilkumara Fernando
    May 19, 2004
  4. Guest

    Current path to Qualified Path

    Guest, Oct 14, 2004, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    428
    Tom Ogilvy
    Oct 14, 2004
  5. alondon
    Replies:
    5
    Views:
    390
    alondon
    Apr 17, 2007
  6. Stefan Mueller

    How to get the current path

    Stefan Mueller, Jul 16, 2007, in forum: Microsoft Excel Programming
    Replies:
    19
    Views:
    570
    NickHK
    Jul 30, 2007
  7. joemeshuggah

    current week, current month, current year

    joemeshuggah, Oct 14, 2008, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    801
  8. abc987

    Open file from path in cell and open from current file path

    abc987, May 4, 2011, in forum: Microsoft Excel Programming
    Replies:
    0
    Views:
    490
    abc987
    May 4, 2011
Loading...