Change Excel Title Bar/Caption

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
How can I change the title "Microsoft Excel - File Name.xls" to custom title
when I launch a particular work book. This change should occur only if I
launch this work book. If I launch any other excel work book then the normal
should occur i.e. "Microsoft Excel - File Name.xls"

Thanks in advance for your help.

BR
 
Private Sub Workbook_Activate()
Application.Caption = "my custom title"
End Sub

Private Sub Workbook_Deactivate()
Application.Caption = Empty
End Sub

Private Sub Workbook_Open()
Application.Caption = "my custom title"
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Bob Thanks for code, it worked partially.
I still get the File name.xls How can I remove the file name?
Is it possible to remove the Excel Symbol/icon image?

I hope I am not asking for too much.
 
Do you mean you get the filename on the customised workbook?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Yes Bob, I get the file name.xls along with "my custom name" instead of
Microsoft Excel.
So maybe I am not clear in what I want. Therefore a quick recap.
The Microsoft Excel is removed but the file name still appears after "my
custom name"
Thanks in advance if it can be solved.
 
I don't get that. You do mean that you get say

WorkbookName.xls - my custom title

in the application bar.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
No, it's

my custom title - WorkbookName.xls

I think that's just how Excel works. The "caption" you can change is only
the first part of the entire caption, which also includes the file name. If
you don't maximize the open workbook, then the workbook name does not
appear.

- Jon
 
Option Explicit
Private Declare Function FindWindow _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText _
Lib "user32" Alias "SetWindowTextA" _
(ByVal hwnd As Long, _
ByVal lpString As String) As Long

Sub AlterExcelCaption(strCaption As String)
SetWindowText FindWindow("XLMAIN", Application.Caption), strCaption
End Sub

Sub test()
AlterExcelCaption "Just testing"
End Sub


RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top