ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CommandBar problem - Question (https://www.excelbanter.com/excel-programming/345717-commandbar-problem-question.html)

Les Stout[_2_]

CommandBar problem - Question
 
Hi All, i use the code below to hide toolbars and command bar. Some of
my users are experiencing loss of functions on the command bar e.g.
"Find", "Replace" and GoTo. Is this a coincidence or can it be the
method ?

Is there a way to get the functions back ?

'------------------------------ Record and hide toolbars
----------------------
Sub HideAllToolbarsStd()
Dim TB As CommandBar
Dim TBNum As Integer
Dim TBSheet As Worksheet
Set TBSheet = Workbooks("Recon_Tool.xls").Worksheets("TBSheet")
Application.ScreenUpdating = False
' clear the sheet
TBSheet.Cells.Clear
'------------- Hide all visable toolbars and store their names in
TBSheet --------------------
TBNum = 0
For Each TB In CommandBars
If TB.Type = msoBarTypeNormal Then
If TB.Visible Then
TBNum = TBNum + 1
TB.Visible = False
TBSheet.Cells(TBNum, 1) = TB.Name
End If
End If
Next TB
Application.ScreenUpdating = True
Application.CommandBars("Worksheet Menu Bar").Enabled = False
Application.DisplayFormulaBar = False
addToolbarStd
End Sub



Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Ron de Bruin

CommandBar problem - Question
 
Hi Les

my users are experiencing loss of functions on the command bar e.g.
"Find", "Replace" and GoTo. Is this a coincidence or can it be the
method ?


Can't see why this will happen when you use this
Application.CommandBars("Worksheet Menu Bar").Enabled = False


But why you store the bar names in a worksheet and make them not visible
You can also use Enabled = False for the other bars


Sub Disable_Command_Bars_1()
'This will disable all BuiltIn Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
If Cbar.BuiltIn = True Then
Cbar.Enabled = False
End If
Next
End Sub
More info here
http://www.rondebruin.com/menuid.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Les Stout" wrote in message ...
Hi All, i use the code below to hide toolbars and command bar. Some of
my users are experiencing loss of functions on the command bar e.g.
"Find", "Replace" and GoTo. Is this a coincidence or can it be the
method ?

Is there a way to get the functions back ?

'------------------------------ Record and hide toolbars
----------------------
Sub HideAllToolbarsStd()
Dim TB As CommandBar
Dim TBNum As Integer
Dim TBSheet As Worksheet
Set TBSheet = Workbooks("Recon_Tool.xls").Worksheets("TBSheet")
Application.ScreenUpdating = False
' clear the sheet
TBSheet.Cells.Clear
'------------- Hide all visable toolbars and store their names in
TBSheet --------------------
TBNum = 0
For Each TB In CommandBars
If TB.Type = msoBarTypeNormal Then
If TB.Visible Then
TBNum = TBNum + 1
TB.Visible = False
TBSheet.Cells(TBNum, 1) = TB.Name
End If
End If
Next TB
Application.ScreenUpdating = True
Application.CommandBars("Worksheet Menu Bar").Enabled = False
Application.DisplayFormulaBar = False
addToolbarStd
End Sub



Les Stout

*** Sent via Developersdex http://www.developersdex.com ***




Les Stout[_2_]

CommandBar problem - Question
 
Hello Ron, dankie vir jou e-pos. Ron is there a way to get all the
control numbers ?
What do you think caused the problem of the drop down controls
dissapeariing ?

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Les Stout[_2_]

CommandBar problem - Question
 
Hi Ron, my apologies i did find them at the bottom of the page. Ron i
used your code which hide them all but do not see code to show them all,
please help....

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Ron de Bruin

CommandBar problem - Question
 
http://www.rondebruin.com/menuid.htm#Information

2) Important !!!!!

All examples use Enabled = False to disable the control(s).

If you want to restore it change False to True in the code


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Les Stout" wrote in message ...
Hi Ron, my apologies i did find them at the bottom of the page. Ron i
used your code which hide them all but do not see code to show them all,
please help....

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***




Ron de Bruin

CommandBar problem - Question
 
What do you think caused the problem of the drop down controls
dissapeariing ?


No Idea


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Les Stout" wrote in message ...
Hello Ron, dankie vir jou e-pos. Ron is there a way to get all the
control numbers ?
What do you think caused the problem of the drop down controls
dissapeariing ?

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***




Les Stout[_2_]

CommandBar problem - Question
 
Hello Ron, so would i then change the code as per below ?

Ron, i have a BIIIIG problem, i tried your code to mad all bars False
and the cleaning plugged my PC out by mistake now i have no bars and
cannot get them by right clicking either....What can i do... ??


Sub Disable_Command_Bars_1()
'This will disable all BuiltIn Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
If Cbar.BuiltIn = False Then
Cbar.Enabled = True
End If
Next
End Sub


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Ron de Bruin

CommandBar problem - Question
 
Hi Les

Look on the site

Sub Disable_Command_Bars_1()
'This will disable all BuiltIn Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
If Cbar.BuiltIn = True Then
Cbar.Enabled = False
End If
Next
End SubTo reset changeCbar.Enabled = False
toCbar.Enabled = true

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Les Stout" wrote in message ...
Hello Ron, so would i then change the code as per below ?

Ron, i have a BIIIIG problem, i tried your code to mad all bars False
and the cleaning plugged my PC out by mistake now i have no bars and
cannot get them by right clicking either....What can i do... ??


Sub Disable_Command_Bars_1()
'This will disable all BuiltIn Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
If Cbar.BuiltIn = False Then
Cbar.Enabled = True
End If
Next
End Sub


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***




Les Stout[_2_]

CommandBar problem - Question
 
Heelo Ron, than ks that is how i changes my code posted in the last
question. Could you please help me with the loss of all my bars after
the cleaning lady switched my PC off ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Ron de Bruin

CommandBar problem - Question
 
You change your code wrong Les

This is your code

If Cbar.BuiltIn = False Then
Cbar.Enabled = True

Must be this to reset

If Cbar.BuiltIn = True Then
Cbar.Enabled = True



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Les Stout" wrote in message ...
Heelo Ron, than ks that is how i changes my code posted in the last
question. Could you please help me with the loss of all my bars after
the cleaning lady switched my PC off ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***




Les Stout[_2_]

CommandBar problem - Question
 
Hi Ron, all sorted out thanks.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


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

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