VBA: Show custom title in Excel caption

FryGirl

Well-known Member
Joined
Nov 11, 2008
Messages
1,368
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
This is just a small part of my workbook open code, but the only question is about the use of the caption property.

Using the With Application makes the caption spread to all open workbooks, but I need this just on the workbook that contains the code.

I tried a few examples like Application.ActiveWorkbook, but that doesn't compile.

Code:
Private Sub Workbook_Open()
    With Application
        .Caption = CurCaption & CurVersion
        .StatusBar = MyPOC
    End With

End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
This doesn't add the caption after the book name, but replaces it.

Code:
ActiveWorkbook.Windows(1).Caption = "bla"

I guess you could use something like this though to replicate the result

Code:
ActiveWorkbook.Windows(1).Caption = ActiveWorkbook.name & " - " & "bla"
 
Last edited:
Upvote 0
I don't think you can have the Application caption for just one workbook.

In the top application title bar is the application caption followed by the currently activeworkbook name.

The application caption is the same for all open workbooks.

The active workbook name will change for each workbook when they are activated. You could SaveAs the workbook with CurCaption & CurVersion to change its name.
 
Upvote 0
Thank you both for your time. In the end, I think I will do away with the caption. It' serving no real purpose in my workbook.
 
Upvote 0

Forum statistics

Threads
1,223,947
Messages
6,175,562
Members
452,652
Latest member
eduedu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top