ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can we disable Excel's default toolbar? (https://www.excelbanter.com/excel-programming/308985-can-we-disable-excels-default-toolbar.html)

JK

Can we disable Excel's default toolbar?
 
My application deletes Excel's toolbar and creates my toolbar. However,
Excel (at least with 2003) retains one icon on my tool bar to the immediate
left that allows the user several options I don't want the user to select.

Is it possible, when creating my toobar, to disable this Excel icon and/or
selections?

Thank you in advance.

Jim Kobzeff



Rob Bovey

Can we disable Excel's default toolbar?
 
"JK" wrote in message news:PU9_c.683$Va5.412@trnddc01...
My application deletes Excel's toolbar and creates my toolbar. However,
Excel (at least with 2003) retains one icon on my tool bar to the

immediate
left that allows the user several options I don't want the user to select.

Is it possible, when creating my toobar, to disable this Excel icon and/or
selections?


Hi Jim,

This icon can be removed by protecting your workbook. It's the Windows
protection option that does the trick. It doesn't matter whether or not you
protect the Structure.

--
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 *



JK

Can we disable Excel's default toolbar?
 
Thank you, Rob. I did as you suggested, but it didn't work. The Excel icon
and its menu selections remain alive and well.

Jim Kobzeff

"Rob Bovey" wrote in message
...
"JK" wrote in message news:PU9_c.683$Va5.412@trnddc01...
My application deletes Excel's toolbar and creates my toolbar. However,
Excel (at least with 2003) retains one icon on my tool bar to the

immediate
left that allows the user several options I don't want the user to
select.

Is it possible, when creating my toobar, to disable this Excel icon
and/or
selections?


Hi Jim,

This icon can be removed by protecting your workbook. It's the Windows
protection option that does the trick. It doesn't matter whether or not
you
protect the Structure.

--
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 *





Rob Bovey

Can we disable Excel's default toolbar?
 
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 *


"JK" wrote in message news:Rgk_c.954$PK3.132@trnddc08...
Thank you, Rob. I did as you suggested, but it didn't work. The Excel icon
and its menu selections remain alive and well.

Jim Kobzeff

"Rob Bovey" wrote in message
...
"JK" wrote in message news:PU9_c.683$Va5.412@trnddc01...
My application deletes Excel's toolbar and creates my toolbar. However,
Excel (at least with 2003) retains one icon on my tool bar to the

immediate
left that allows the user several options I don't want the user to
select.

Is it possible, when creating my toobar, to disable this Excel icon
and/or
selections?


Hi Jim,

This icon can be removed by protecting your workbook. It's the

Windows
protection option that does the trick. It doesn't matter whether or not
you
protect the Structure.

--
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 *







JK

Can we disable Excel's default toolbar?
 
Thank you, Rob. That did it.

Jim Kobzeff
"Rob Bovey" wrote in message
...
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 *


"JK" wrote in message news:Rgk_c.954$PK3.132@trnddc08...
Thank you, Rob. I did as you suggested, but it didn't work. The Excel
icon
and its menu selections remain alive and well.

Jim Kobzeff

"Rob Bovey" wrote in message
...
"JK" wrote in message news:PU9_c.683$Va5.412@trnddc01...
My application deletes Excel's toolbar and creates my toolbar.
However,
Excel (at least with 2003) retains one icon on my tool bar to the
immediate
left that allows the user several options I don't want the user to
select.

Is it possible, when creating my toobar, to disable this Excel icon
and/or
selections?

Hi Jim,

This icon can be removed by protecting your workbook. It's the

Windows
protection option that does the trick. It doesn't matter whether or not
you
protect the Structure.

--
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 *










All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com