chestera
asked on
Excel Headings
Hi
Is it possible to put a graphic in an Excell heading either 97 or 2000 eg a company logo.
chestera
Is it possible to put a graphic in an Excell heading either 97 or 2000 eg a company logo.
chestera
Found this
-------------------------- ----------
Subject: Re: Code for changing Excel icon
Date: 11/02/2000
Untested, but here is a message I saved on the topic:
'Mark Lundberg said
'Here's some code that will change the XL icon both
'for the Excel system menu (top left corner), and in
'the taskbar. I can't remember where I got the code
'from, but I think it was Stephen Bullen's. Seems likely,
'anyway <g>.
'Get the handle for a window
Declare Function wapiFindWindow Lib "user32" Alias "FindWindowA" _ (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
'Extract an icon from a file
Declare Function wapiExtractIcon Lib "shell32.dll" Alias "ExtractIconA" _
(ByVal hInst As Long, ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
'Send a Windows message
Declare Function wapiSendMessage Lib "user32" Alias "SendMessageA" _ (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, _ ByVal lparam As
Long) As Long
'Windows message types
Public Const WM_SETICON = &H80
Sub changeicon()
Dim sName As String
sName = "C:\Test\example.ico"
'Uncomment the next line to restore the standard Excel icon. 'sName
= "C:\Program Files\Microsoft Office97\Office\msoffice.e xe" Call
procSetIcon(sName)
End Sub
Sub procSetIcon(sIconPath)
Dim a As Long, ihWnd As Long, ihIcon As Long
'Get the handle of the Excel window
ihWnd = wapiFindWindow("XLMAIN", Application.Caption)
'Get the icon from the source
ihIcon = wapiExtractIcon(0, sIconPath, 0)
'1 means invalid icon source, 0 means no icons in source
If ihIcon > 1 Then
'Set the big (32x32) and small (16x16) icons
a = wapiSendMessage(ihWnd, WM_SETICON, True, ihIcon)
a = wapiSendMessage(ihWnd, WM_SETICON, False, ihIcon)
End If
End Sub
If it was a Stephen's site, you can go there with
http://www.BMSLtd.co.uk then go to the Excel or other Excel related page.
Regards,
Tom Ogilvy
-------------------------- ----------
not tested this
:O)Bruintje
--------------------------
Subject: Re: Code for changing Excel icon
Date: 11/02/2000
Untested, but here is a message I saved on the topic:
'Mark Lundberg said
'Here's some code that will change the XL icon both
'for the Excel system menu (top left corner), and in
'the taskbar. I can't remember where I got the code
'from, but I think it was Stephen Bullen's. Seems likely,
'anyway <g>.
'Get the handle for a window
Declare Function wapiFindWindow Lib "user32" Alias "FindWindowA" _ (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
'Extract an icon from a file
Declare Function wapiExtractIcon Lib "shell32.dll" Alias "ExtractIconA" _
(ByVal hInst As Long, ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
'Send a Windows message
Declare Function wapiSendMessage Lib "user32" Alias "SendMessageA" _ (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, _ ByVal lparam As
Long) As Long
'Windows message types
Public Const WM_SETICON = &H80
Sub changeicon()
Dim sName As String
sName = "C:\Test\example.ico"
'Uncomment the next line to restore the standard Excel icon. 'sName
= "C:\Program Files\Microsoft Office97\Office\msoffice.e
procSetIcon(sName)
End Sub
Sub procSetIcon(sIconPath)
Dim a As Long, ihWnd As Long, ihIcon As Long
'Get the handle of the Excel window
ihWnd = wapiFindWindow("XLMAIN", Application.Caption)
'Get the icon from the source
ihIcon = wapiExtractIcon(0, sIconPath, 0)
'1 means invalid icon source, 0 means no icons in source
If ihIcon > 1 Then
'Set the big (32x32) and small (16x16) icons
a = wapiSendMessage(ihWnd, WM_SETICON, True, ihIcon)
a = wapiSendMessage(ihWnd, WM_SETICON, False, ihIcon)
End If
End Sub
If it was a Stephen's site, you can go there with
http://www.BMSLtd.co.uk then go to the Excel or other Excel related page.
Regards,
Tom Ogilvy
--------------------------
not tested this
:O)Bruintje
ASKER
:O)Bruintje
A page heading, I have no problems with text.
chestera
A page heading, I have no problems with text.
chestera
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Bruintje
Thanks your help, you have just confirmed what I thought the situation was. I can cut and paste a logo onto the spreadsheet, would have been better to be able to cut and paste into a page Header, such is life.
chestera
Thanks your help, you have just confirmed what I thought the situation was. I can cut and paste a logo onto the spreadsheet, would have been better to be able to cut and paste into a page Header, such is life.
chestera
What heading do you mean? the Application caption?
:O)Bruintje