Changing Excel Logo & VBA warning

BjornBehr
BjornBehr used Ask the Experts™
on
1) In excel how do you go about changing the Excel logo (Top left of screen) through VB/VBA?

2) Is it at all possible to stop the Macro warning from poping up in Office through VB/VBA?


Regards
Bjorn
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
1) VB/VBA: Not possible.
* for the Application, you might try to "hack" the excel.exe file to replace the excel icons...
* in the Explorer, you can easily (view change file type ...), but that's not the question here...

2) Application.DisplayAlerts = false

CHeers

Commented:
1. is not possible without hacking the program as far as i'm aware.
2. Tools > Options> Security Tab > Macro Security Button

Hope this helps

Marion
Bjorn

1. With win32 APIs on the window. The change will be temporary
(until you close the main window application).

2. Through VB/VBA. I would say No, but not sure.
   Changing the security level would change  security for all
   workbooks... not very safe.
   Maybe you could sign your code (using certif) so once approved
   by the user one time it would not request any approval aftre that, neither show warning.

Probably some better ways to do that out there.

Sébastien
Top Expert 2006
Commented:
Hello BjornBehr
1. was answered in the wrong question here

http://www.experts-exchange.com/Applications/MS_Office/Q_20361853.html


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

misunderstood the questioner....:)

2.
on the signing of your code with a certificate
http://www.microsoft.com/officedev/articles/opg2k17.htm

HAGD:O)Bruintje

Author

Commented:
Thanks all.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial