How to get current workbook name in Excel?
While using Microsoft Excel, you may require to get the workbook name for some purpose and insert the file name into a cell. In this article, we are going to show you methods of getting current workbook name in Excel with details.
You can get current workbook name with the User-defined function as follows.
1. Press Alt + F11 keys simultaneously to open the Microsoft Visual Basic Application window.
2. In the Microsoft Visual Basic Application window, click Insert > Module.
3. Copy following code into the Module window.
VBA code: Get workbook name
Function GetBook() As String GetBook = ActiveWorkbook.Name End Function
4. Press Alt + Q keys to close the Microsoft Visual Basic Application window and return to the workbook.
5. Select a blank cell, type =GetBook() into the cell, then press the Enter key. You can see the workbook name is populated on the selected cell.
With the Insert Workbook Information utility of Kutools for Excel, you can easily get the workbook name by inserting the workbook name into selected cell, page header or footer. Please do as follows.
Before applying Kutools for Excel, please download and install it firstly.
1. Click Kutools Plus > Workbook > Insert Workbook Information. See screenshot:
2. In the Insert Workbook Information dialog box, select Workbook name option in the Information section, and select the Range option to select a cell where you want to put the result in the Insert at section, and then click the OK button. See screenshot:
Now the workbook name is inserted into the selected cell immediately.
Note: You can also insert the workbook name into the header or footer as you need.
Best Office Productivity Tools
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...
Supercharge Your Excel Skills: Experience Efficiency Like Never Before with Kutools for Excel (Full-Featured 30-Day Free Trial)
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day! (Full-Featured 30-Day Free Trial)