Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    119

    Unanswered: Function to get the current path/directory

    What is the function to get the durrent path/directory of where my file is?

    I have an excel file in which cell (A1) should contain/display the current path or directory where this said file is saved? What is that function pls.?

    Thanks a lot.

  2. #2
    Join Date
    May 2009
    Posts
    258
    You can set it through VBA, use Application.Path

    Regards,

    Ax

  3. #3
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    I think to get the directory of the Excel file running the code you need this

    ThisWorkbook.Path

    Application.Path returns the diectory of Excel.exe !!?

    HTH


    MTB

  4. #4
    Join Date
    May 2009
    Posts
    258
    Yeah, you're right, you'll want to use ActiveWorkbook.Path. My bad.

  5. #5
    Join Date
    Dec 2003
    Location
    Ottawa, Canada
    Posts
    72
    hi

    You could also use the CELL function in Excel:

    If you want the name and path of the active spreadsheet to be entered automatically in a cell, use the formula: =CELL("filename" )

    if you want only the filename use :
    =MID(CELL("filename" ,A1),FIND("[" ,CELL("filename" ,A1))+1,FIND("]" ,CELL("filename" ,A1))-FIND("[" ,CELL("filename",A1))-1)
    A piece of data is like a brick
    If you don't build anything with it
    It is just a brick
    www.excel-examples.com

Posting Permissions

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