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. Richy

    Set The Directory to the Current WB Path

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

    changing current directory to that of the current open file

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

    Current path to Qualified Path

    Guest, Oct 14, 2004, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    311
    Tom Ogilvy
    Oct 14, 2004
  4. joemeshuggah

    current week, current month, current year

    joemeshuggah, Oct 14, 2008, in forum: Microsoft Excel Programming
    Replies:
    1
    Views:
    552
  5. 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:
    387
    abc987
    May 4, 2011
Loading...

Share This Page