Insert The File Path and Filename into Header or Footer
This post will guide you how to add the file path and filename into a header or footer in Excel. How do I insert the file path and filename into the current worksheet header or footer in Excel.
Insert The File Path and Filename into Header or Footer
If you want to put a file path and filename into your worksheet header or footer in Excel, you just need to use the Header and Footer tools to add it. Do the following steps:
#1 go to INSERT tab, and click Header& Footer command under Text group.
#2 click header in your worksheet, and go to DESIGN tab, click File Path and File Name commands under Header& Footer Elements group.
#3 click any cell in your worksheet, and the file path and file name will be inserted into the selected header in your worksheet.
You can also use an excel VBA macro to achieve the same result. Just do the following steps:
#1 open your excel workbook and then click on “Visual Basic” command under DEVELOPER Tab, or just press “ALT+F11” shortcut.
#2 then the “Visual Basic Editor” window will appear.
#3 click “Insert” ->”Module” to create a new module
#4 paste the below VBA code into the code window. Then clicking “Save” button.
Sub InsertFilePath() ActiveSheet.PageSetup.CenterHeader = ActiveWorkbook.FullName End Sub
#5 back to the current worksheet, then run the above excel macro. Click Run button.
#6 Let’s see the result:
The above VBA macro will insert the file path and the file name into the center header. and if you want to insert it to other position, you can specify a different place for the path and filename, you just need to change CenterHeader to another location, such as: CenterFooter, LeftFooter, RightFooter, Leftheader, or RightHeader.
Comments
So empty here ... leave a comment!