View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Shazi Shazi is offline
external usenet poster
 
Posts: 74
Default Hot to change the Excel File Logo (VBA Project)

On Jul 16, 1:42*pm, Shazi wrote:
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

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