ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updating ExcelName Registry Key (https://www.excelbanter.com/excel-programming/396056-updating-excelname-registry-key.html)

Don[_30_]

Updating ExcelName Registry Key
 
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!


Leith Ross[_2_]

Updating ExcelName Registry Key
 
On Aug 21, 2:27 pm, Don wrote:
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



Dave Peterson

Updating ExcelName Registry Key
 
You may want to use an event that changes the caption when your workbook is
active.

Chip Pearson has some instructions on events:
http://www.cpearson.com/excel/events.htm

David McRitchie has some notes, too:
http://www.mvps.org/dmcritchie/excel/event.htm

Don wrote:

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!


--

Dave Peterson

Peter T

Updating ExcelName Registry Key
 
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

"Don" wrote in message
ups.com...
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!




Don[_30_]

Updating ExcelName Registry Key
 
On Aug 22, 2:11 am, "Peter T" <peter_t@discussions wrote:
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

"Don" wrote in message

ups.com...



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!- Hide quoted text -


- 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...



All times are GMT +1. The time now is 06:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com