![]() |
changing the application name in the title bar
I once read there was a way to change the name of an application as it
appears in the Excel title bar. That is, to replace the "Microsoft Excel - filename.xls" with whatever name you want to use. I tried using "Application.Name = "my application name" but I got the error message "Can't assign to read-only property." Is there a way to accomplish this? Thanks in advance Paul |
changing the application name in the title bar
Application.Caption = "MyNewCaption"
-- Vasant "Paul James" wrote in message ... I once read there was a way to change the name of an application as it appears in the Excel title bar. That is, to replace the "Microsoft Excel - filename.xls" with whatever name you want to use. I tried using "Application.Name = "my application name" but I got the error message "Can't assign to read-only property." Is there a way to accomplish this? Thanks in advance Paul |
changing the application name in the title bar
Paul
Vasant gave you the code for this but must be noted that this is not a permanent change and has to be re-done each time you close out and re-start Excel. Place the code into a Thisworkbook Workbook_Open Sub or a General Module Auto_Open Sub. Gord Dibben Excel MVP On Mon, 22 Dec 2003 13:55:19 -0800, "Paul James" wrote: I once read there was a way to change the name of an application as it appears in the Excel title bar. That is, to replace the "Microsoft Excel - filename.xls" with whatever name you want to use. I tried using "Application.Name = "my application name" but I got the error message "Can't assign to read-only property." Is there a way to accomplish this? Thanks in advance Paul |
changing the application name in the title bar
Application.Caption = "MyNewCaption"
So that's how you do it! Thanks (again), Vasant. Question: I notice that when I do this, it not only puts "MyNewCaption" in the title bar, but it also adds the filename to the string I assign to the Caption property. In other words, it places "MyNewCaption - MyFilename.xls" in the title bar. Is there a parameter I can add to the property assignment that would remove the filename from the caption, and only display the assigned string? |
changing the application name in the title bar
Thanks, Gord. That's good information to have.
I'll put it in the Auto_Open sub. Another question: I only need the custom caption while a particular workbook is open. If I want to reset the caption when that workbook closes, can I do that by simply putting Application.Caption = "Microsoft Excel" in the Auto_Close procedure? Thanks |
changing the application name in the title bar
application.caption = ""
would reset it. Paul James wrote: Thanks, Gord. That's good information to have. I'll put it in the Auto_Open sub. Another question: I only need the custom caption while a particular workbook is open. If I want to reset the caption when that workbook closes, can I do that by simply putting Application.Caption = "Microsoft Excel" in the Auto_Close procedure? Thanks -- Dave Peterson |
changing the application name in the title bar
Or add the activewindow.caption
Sub bothcaptions() Application.Caption = "MyApplication" ActiveWindow.Caption = "" End Sub Gord On Mon, 22 Dec 2003 17:33:08 -0600, Dave Peterson wrote: I think that this is actually showing the activeworkbook's name since you have the workbook's window maximized. I think it's excel's way of helping you. (If you restore the workbook's window (not the application's window), to less than maximized, you'll see that the appliation caption doesn't show the workbook's name. Paul James wrote: Application.Caption = "MyNewCaption" So that's how you do it! Thanks (again), Vasant. Question: I notice that when I do this, it not only puts "MyNewCaption" in the title bar, but it also adds the filename to the string I assign to the Caption property. In other words, it places "MyNewCaption - MyFilename.xls" in the title bar. Is there a parameter I can add to the property assignment that would remove the filename from the caption, and only display the assigned string? |
changing the application name in the title bar
Better answer.
Gord, Dibben wrote: Or add the activewindow.caption Sub bothcaptions() Application.Caption = "MyApplication" ActiveWindow.Caption = "" End Sub Gord On Mon, 22 Dec 2003 17:33:08 -0600, Dave Peterson wrote: I think that this is actually showing the activeworkbook's name since you have the workbook's window maximized. I think it's excel's way of helping you. (If you restore the workbook's window (not the application's window), to less than maximized, you'll see that the appliation caption doesn't show the workbook's name. Paul James wrote: Application.Caption = "MyNewCaption" So that's how you do it! Thanks (again), Vasant. Question: I notice that when I do this, it not only puts "MyNewCaption" in the title bar, but it also adds the filename to the string I assign to the Caption property. In other words, it places "MyNewCaption - MyFilename.xls" in the title bar. Is there a parameter I can add to the property assignment that would remove the filename from the caption, and only display the assigned string? -- Dave Peterson |
changing the application name in the title bar
Paul
Yes, you can reset it in the Auto_close code. If you leave it blank, it will default to "Microsoft Excel" Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.Caption = "" End Sub Gord Dibben Excel MVP On Mon, 22 Dec 2003 15:04:59 -0800, "Paul James" wrote: Thanks, Gord. That's good information to have. I'll put it in the Auto_Open sub. Another question: I only need the custom caption while a particular workbook is open. If I want to reset the caption when that workbook closes, can I do that by simply putting Application.Caption = "Microsoft Excel" in the Auto_Close procedure? Thanks |
changing the application name in the title bar
Hi Paul:
Here's a complete set of routines that I think will do what you want: Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.Caption = "" End Sub Private Sub Workbook_Open() Application.Caption = "MyNewCaption" With ActiveWindow If .WindowState = xlMaximized Then .Caption = "" Else .Caption = Name End If End With End Sub Private Sub Workbook_WindowResize(ByVal Wn As Window) With Wn If .WindowState = xlMaximized Then .Caption = "" Else .Caption = Name End If End With End Sub Of course, these go in the ThisWorkbook moduile. If you are going to have other workbooks open at the same time and only want this behavior for one of them, you will have to add similar code to the Activate and Deactivate events for the workbook as well. Also, if you want to get really sophisticated, check out John Walkenbach's site for what to do to prevent the BeforeClose event from firing if the user changes his/her mind and does not close the workbook. http://j-walk.com/ss/excel/tips/tip78.htm Regards, Vasant. "Paul James" wrote in message ... Application.Caption = "MyNewCaption" So that's how you do it! Thanks (again), Vasant. Question: I notice that when I do this, it not only puts "MyNewCaption" in the title bar, but it also adds the filename to the string I assign to the Caption property. In other words, it places "MyNewCaption - MyFilename.xls" in the title bar. Is there a parameter I can add to the property assignment that would remove the filename from the caption, and only display the assigned string? |
changing the application name in the title bar
Great information, guys.
My thanks to Gord, Vasant and Dave. |
All times are GMT +1. The time now is 10:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com