VBA file path

Display file path to the current workbook

In order to create a simple subroutine that shows a path to the active workbook follows this steps.

  1. Open VBA Editor (Alt + F11),
  2. Insert the following code into your project.

It will display three dialog boxes with:

  • full file path,
  • directory_path,
  • file_name + extension

You can also create functions to show you data inside a cell. First, create a module for your worksheet. This easy function will show you a path to the current file inside a cell.

As you can see, the function name is inserted into the cell.