Hot to change the Excel File Logo (VBA Project)

  • Thread starter Thread starter Shazi
  • Start date Start date
S

Shazi

Hi,

I made a vba project, and I want to change the Excel File Logo (Excel
File Icon). to give a professional look of my vba program.

How it is possible.....

If any one knows pls send me reply.

Regards.

Shahzad
 
Hi,

I made a vba project, and I want to change the Excel File Logo (Excel
File Icon). to give a professional look of my vba program.

How it is possible.....

If any one knows pls send me reply.

Regards.

Shahzad


I find the below procedure on the web, but its not working, pls
check what is the mistake, if any one knows.

*****************

This code shows you how to change the Excel icon:

Declare Function GetActiveWindow32 Lib "USER32" Alias _
"GetActiveWindow" () As Integer

Declare Function SendMessage32 Lib "USER32" Alias _
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long

Declare Function ExtractIcon32 Lib "SHELL32.DLL" Alias _
"ExtractIconA" (ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long

Sub ChangeXLIcon()
Dim h32NewIcon As Long
Dim h32WndXLMAIN As Long
h32NewIcon = ExtractIcon32(0, "Notepad.exe", 0)
h32WndXLMAIN = GetActiveWindow32()
SendMessage32 h32WndXLMAIN, &H80, 1, h32NewIcon 'Icon big
SendMessage32 h32WndXLMAIN, &H80, 0, h32NewIcon 'Icon small
End Sub

************
 
Back
Top