The top line of the window is the Title bar. Use the available empty space to add metadata related to workbook.
To add metadata, we will add code to workbook activate event. So, title of the workbook will change when workbook is activated.
By default, Excel workbook features “Microsoft Excel” as title.
To add a title to the Title bar:
1. Press Alt+F11 to open the VBE.
2. In the VBAProject pane, double-click ThisWorkbook.
3. At the top of the module, open the left drop down list (General) and select Workbook, then select the Activate event from the event drop down list on the right.
4. In the Activate event, type the following code:
Application.Caption = "Macro File"
Above code will assign “Macro File” as title to the workbook.
5. To cancel the displaying title while activating or opening a different workbook, add the Deactivate event by selecting Deactivate from the Procedure drop down list.
6. In the Deactivate event, type the following code:
Please follow below for the code
Option Explicit Private Sub Workbook_Activate() 'Changing the caption of the workbook Application.Caption = "Macro File" End Sub Private Sub Workbook_Deactivate() 'Changing the caption of the workbook to blank Application.Caption = "" End Sub
We would love to hear from you, do let us know how we can improve our work and make it better for you. Write to us at firstname.lastname@example.org
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.