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.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
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.
|Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.|
1. Click Enterprise > 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.