Updating ExcelName Registry Key

D

Don

I have created an App in Excel that I would like to display the
"Window Caption - MyApp Name" instead MyApp filename and " - Microsoft
Excel" in the Title Bar.

Is there a way to update the "HKEY_CURRENT_USER\Software\Microsoft
\Office\12.0\Excel\ExcelName" registry key everytime the app opens?

I can't even manually set it in the regitsry and open Excel. The key
automatically resets to "Microsoft Excel" after the file loads.
Thanks!
 
L

Leith Ross

I have created an App in Excel that I would like to display the
"Window Caption - MyApp Name" instead MyApp filename and " - Microsoft
Excel" in the Title Bar.

Is there a way to update the "HKEY_CURRENT_USER\Software\Microsoft
\Office\12.0\Excel\ExcelName" registry key everytime the app opens?

I can't even manually set it in the regitsry and open Excel. The key
automatically resets to "Microsoft Excel" after the file loads.
Thanks!

Hello Don,

You can "brand" Excel using a few API calls. Place these in a Standard
VBA Module.

'This will be used to find the Window to Excel
Public Declare Function FindWindow _
Lib "user32.dll" _
Alias "FindWindowA" _
(ByVal lpszClass As String, _
ByVal lpszWindow As String) As Long

'This will be used to change the Window Caption
Private Declare Function SetWindowText _
Lib "user32.dll" _
Alias "SetWindowTextA" _
(ByVal hWnd As Long, _
ByVal lpszBuffer As String) As Long

Public Sub BrandExcel()
Dim NewTitle As String
Dim hWnd As Long
Dim Retval
' Change NewTitle to what you want
NewTitle = "Book 1"
' Returns zero if function fails
hWnd = FindWindow("XLMAIN", vbNullString)
' Return 1 if title was changed
Retval = SetWindowText(hWnd, NewTitle)
End Sub

Sincerely,
Leith Ross
 
P

Peter T

Another one -

Sub AppCap(sCaption As String)

If Len(sCaption) Then
ActiveWindow.Caption = ""
Application.Caption = sCaption
Else
Application.Caption = ""
ActiveWindow.Caption = False
End If

End Sub

Sub test3()
AppCap "My App Caption"

' pass an empty string to reset
' AppCap ""
End Sub

Regards,
Peter T
 
D

Don

Another one -

Sub AppCap(sCaption As String)

If Len(sCaption) Then
ActiveWindow.Caption = ""
Application.Caption = sCaption
Else
Application.Caption = ""
ActiveWindow.Caption = False
End If

End Sub

Sub test3()
AppCap "My App Caption"

' pass an empty string to reset
' AppCap ""
End Sub

Regards,
Peter T








- Show quoted text -

Thanks very much, everyone. I will have to do some tweaks because
excel 2003 and 2007 behave differently with those subs. Yet another
layer of macros to run based off of the version of Excel being used...
 

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

Top