ThisWorkbook.Path

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,304
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
The folder which contains the Excel file I'm working on is

C:\Users\ar3\Documents\Key Performance Indicators\

however if I place =INFO("directory") in a cell I get

C:\Users\ar3\Documents\

Is there a function where I can get the full path of the workbook in the cell?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
That function should give you the full path of the directory you're working with which WON'T always be the same as the current file. May sound daft but have you

a) Saved the worksheet (otherwise the default directory is your documents folder)

and b) Recalculated the cell containing the formula

and c) Not opened, saved or otherwise edited anything in Excel since doing that.

---

A Quick UDF to provide path for whichever workbook it is in.

Code:
Function ThisBookPath()

ThisBookPath = ThisWorkbook.Path
End Function
 
Upvote 0
I set the formula calculation to Automatic, saved and closed the workbook and then opened it and I still got the same answer as before.

In the Immediate window I get the full path, when I use ThisWorkbook.Path
.
 
Upvote 0

Forum statistics

Threads
1,225,071
Messages
6,182,685
Members
453,132
Latest member
nsnodgrass73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top