Display workbook file path
To display the current/active workbook file path in a cell we can use an Excel or a VBA method
Example: Display workbook file path
Sub Display_workbook_file_path()
'display the workbook's file path
ActiveSheet.Range("B5") = Application.ActiveWorkbook.Path
ActiveSheet.Range("B5") = Application.ActiveWorkbook.Path
End Sub
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("B5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
Output Range: Select the output range by changing the cell reference ("B5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
ADDITIONAL NOTES
Result: This VBA code will display the workbook file path without the "\" at the end of the file path. To insert "\" at the end of the file path replace the VBA code with ActiveSheet.Range("B5") = Application.ActiveWorkbook.Path & "\ ".
EXPLANATION
To display the current/active workbook file path in a cell we can use an Excel or a VBA method.
To display the current/active workbook file path in a cell we can use an Excel or a VBA method.
FORMULAS
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1)
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1)
ARGUMENTS
A1: A1 is the cell reference, to cell (A1), of the the sheet where the formula is written.