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.
You are guest
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 2 years agois there any other method? I need to open an excel in any computer, despite the name the user gives to it. Is there any way?
- To post as a guest, your comment is unpublished.· 3 years agocual es el botón otro?