Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Full Path Names in Excel.

Full Path Names in Excel

by Allen Wyatt
(last updated April 5, 2022)

11

When you open a workbook in Excel, the workbook name is displayed in the title bar. At times, it would be nice to display more than a simple workbook name in the title bar. Many people could profit by a way to display a full path name along with the workbook name in the title bar. Unfortunately, Excel does not provide a way to do this easily.

If you only need to know the full path name once in a while, then you can create a very simple macro and assign it to the QAT or a shortcut key. When you run the macro, the information in the title bar for the active window is changed to reflect the full path name. This macro, called ChangeCaption, is as follows:

Sub ChangeCaption()
     ActiveWindow.Caption = ActiveWorkbook.FullName
End Sub

The only drawback to this approach is that whenever you rename your workbook by saving it under a different name, the new file name (and path) are not updated in the title bar unless you rerun the macro.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7850) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Full Path Names in Excel.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Specifying a Paper Tray in a Macro

You may want to use a macro to process and then print your document. Part of that printing may involve specifying which ...

Discover More

Picking a Workbook Format

Need to share workbook information with a wide number of people? It can be puzzling to figure out which version of Excel ...

Discover More

Using Very Large Font Sizes

You can format your text to use some very, very large font sizes. The results you see from formatting with large fonts ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Importing CUSIP Numbers Correctly

It is often necessary to import information from other programs into Excel. Sometimes this can lead to challenges, such ...

Discover More

Avoiding Scientific Notation on File Imports

When importing information from a CSV file, you may get unintended results from time to time. Here's how to force Excel ...

Discover More

Adding a File Path and Filename

If you need to stuff the current workbook's filename and path into a cell or a header or footer, you'll appreciate the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is one minus 1?

2022-04-08 09:58:11

J. Woolley

@Kiwerry
A commonly used abbreviation here in America is RTFM, which translates roughly to "Read the freaking manual." I'm happy you found something useful n My Excel Toolbox. Notice it is available as an Excel add-in (MyToolbox.xlam), which avoids copy/paste issues and makes it available to each workbook you open, including access to the Insert Function (Shift+F3) and My Toolbox Macros (Ctrl+M) dialogs.


2022-04-08 05:18:09

Kiwerry

@ J. Woolley: Thanks for the quick clarification.

My apologies. A commonly used saying here in Germany translates roughly to "Those who can read have an advantage". I had actually visited your site and downloaded the toolbox a week or so ago, but not yet installed anything. On reading your comment I opened the module in a text viewer, copied the function out and pasted it into a module, as you diagnosed.

Thanks too for the Chip Pearson link. After reading that I removed and exported the module, used a text editor to uncomment and slightly amend (added your name to the description) the attributes, and re-imported it. The syntax error is gone and the edited description showed up correctly in the Object Browser.


2022-04-07 10:09:40

J. Woolley

@Kiwerry
Thank you for visiting My Excel Toolbox. As stated there: After reviewing a module's .bas file, "you should use VBE's File > Import File... (Ctrl+M) rather than copy/paste, so the text file's Attribute statements are properly incorporated." Attribute statements are added to a module when it is exported/imported. You can delete them if you copy/paste individual procedures.
See http://www.cpearson.com/excel/CodeAttributes.aspx


2022-04-07 09:11:15

Kiwerry

@ J. Woolley: Thank you.

I immediately installed the NameOf function, but when I ran it the two attribute statements following the Function statement threw a syntax error without showing a description or an error number. The function worked once I commented them out.
Environment: W10 machine, Excel 365.

'Attribute NameOf.VB_Description = "Return Target's Worksheet.Name, Workbook.Name, or Workbook.Path; or return app/environment information as text."
'Attribute NameOf.VB_ProcData.VB_Invoke_Func = "
14"


2022-04-06 10:09:31

J. Woolley

My Excel Toolbox includes the following function to return information about Target (a cell or range):
=NameOf([This], [Target])
The first parameter This can be "sheet" (or "worksheet"), "book" (or "workbook"), "path" (or "filepath"), "app" (or "application"), "caption" (or "titlebar"), "statusbar", "user", "organization", "printer", "computer", "?" (or "help"), or the name of an environment variable (like "TEMP"). This function is similar to Excel's CELL and INFO functions, but perhaps more useful.
See https://sites.google.com/view/MyExcelToolbox/


2022-04-05 11:27:44

Cindy

If you want just the path:
=LEFT(CELL("Filename",$A$1),FIND("[",CELL("Filename",$A$1))-1).
I do not make any claim to authorship for this; it surely was in another version of one of these tip emails


2022-04-05 04:33:15

Kiwerry

The function
=CELL("filename")
will return the full filename; an additional bonus is the sheet name at the end of the string.

Apologies to those for whom this is "coals to Newcastle".


2018-06-04 21:02:52

Julie

You can always add to your page layout for reporting purposes (or just to look at if you are using). Go to Page Layout tab, click the little arrow at the right bottom corner of Page Setup, choose Header/Footer tab, the Custom Footer, and maybe in the right section put your cursor and add the Insert File Path (little folder icon)/Insert File Name (Excel icon). Now you can always see it if you print it out.


2018-06-04 12:15:02

Steven

It is also possible to add the filename to one's Quick Access Toolbar. Select Customize QAT, More Commands. On the list on the left, under Choose Commands From, select Commands Not in the Ribbon. Choose Document Location.
This will always show the path for the current file in the QAT. Depending on how many commands you have in your QAT and your window size, this path listing may be truncated.


2018-06-03 09:39:23

Rhonda Landry

I don't know if this is at all helpful (I'm more of a beginner user), but I wanted to be able to add the full-path name of my current file to my list of files to work on later, so I added the file's full-path to the Quick Access Toolbar. One must click the name to be able to see the actual path (and perhaps arrow over a bit), so it's a bit of a pain, but it is easy for me to click on the name, copy, then paste where I need it. To do this (for other beginners): > File > Options >Customize > Commands Not in Ribbon > Document Location > Add, OK. Thank you so very, very, very much for your tips, and to all the commenters, from an avid learner :-)


2018-06-02 08:30:18

Dave

The other drawback is there is not enough room title bar to show the path if you have other commands there. It would be nice to have it display at the end of the line with the commands tabs since there is more space there.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.