Hi Jim,
Are you sure you're talking about the Excel icon located on the toolbar
or the Excel icon located in the top left corner of the screen? There are
two located roughly one above the other. Protecting the workbook using the
Tools/Protection/Protect Workbook menu and making sure the Windows
checkbox
is selected will definitely remove the icon associated with the menu bar.
The Application window icon cannot be removed, but you can disable and
restore it with API calls as shown below:
Private Const MF_BYCOMMAND As Long = &H0
Private Const SC_CLOSE As Long = &HF060
Private Const API_FALSE As Long = 0&
Private Const API_TRUE As Long = 1&
Private Declare Function FindWindowA Lib "user32" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetSystemMenu Lib "user32" ( _
ByVal hWnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" ( _
ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Sub DeleteXCloseMenu()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Application.Caption)
DeleteMenu GetSystemMenu(hWnd, API_FALSE), SC_CLOSE, MF_BYCOMMAND
DrawMenuBar hWnd
End Sub
Private Sub RestoreXCloseMenu()
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Application.Caption)
GetSystemMenu hWnd, API_TRUE
End Sub
--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/
* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *