ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   help! How do I restore command bars? (https://www.excelbanter.com/new-users-excel/27821-help-how-do-i-restore-command-bars.html)

nrussell

help! How do I restore command bars?
 

Okay,

This may sound like a dumb question but how do I restore the command
bars in Excel. I've managed to delete them all while playing about with
the following code.

Each time I open Excel there is no longer any menus.
I'm in a right panic at this time :eek:

Sub Change_Cell_Menu()
Dim IDnum As Variant
Dim N As Integer
Dim Ctl As CommandBarControl

'Set Enabled to False for all the controls
For Each Ctl In CommandBars("Cell").controls
On Error Resume Next
Ctl.Enabled = False
On Error GoTo 0
Next Ctl
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

Any help is urgently needed.

-Joe


--
nrussell
------------------------------------------------------------------------
nrussell's Profile: http://www.excelforum.com/member.php...o&userid=23731
View this thread: http://www.excelforum.com/showthread...hreadid=374054


Bob Phillips

In the immediate window type

Application.Commandbars("Worksheet Menu Bar").Enabled = True

and then you can do ToolsCustomizeToolbars to get the rest back

--

HTH

RP
(remove nothere from the email address if mailing direct)


"nrussell" wrote in
message ...

Okay,

This may sound like a dumb question but how do I restore the command
bars in Excel. I've managed to delete them all while playing about with
the following code.

Each time I open Excel there is no longer any menus.
I'm in a right panic at this time :eek:

Sub Change_Cell_Menu()
Dim IDnum As Variant
Dim N As Integer
Dim Ctl As CommandBarControl

'Set Enabled to False for all the controls
For Each Ctl In CommandBars("Cell").controls
On Error Resume Next
Ctl.Enabled = False
On Error GoTo 0
Next Ctl
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

Any help is urgently needed.

-Joe


--
nrussell
------------------------------------------------------------------------
nrussell's Profile:

http://www.excelforum.com/member.php...o&userid=23731
View this thread: http://www.excelforum.com/showthread...hreadid=374054




dominicb


Good evening Joe

Have you tried "reversing" your code (ie., change the Enabled=False to
Enabled=True) and rerunning it?

I try not to tinker with my toolbars too mch 'cos it's easy to get into
a pickle and the end result is a bit too permanent for my liking (but
that doesn't help you in this situation...)

Alternatively, try this code:

Sub ShowAll()
Dim UsrSht As Worksheet, UsrCell As Range
Set UsrSht = Sheets("UsrSht")
On Error Resume Next
For Each UsrCell In UsrSht.Range("A:A") _
.SpecialUsrCells(xlUsrCellTypeConstants)
CommandBars(UsrCell.Value).Visible = True
Next UsrCell
End Sub

...and if this doesn't work, you might have to reinstall.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=374054


Alan

"nrussell"
wrote in message news:nrussell.1plyn9_1117059011.0078@excelforum

Okay,

This may sound like a dumb question but how do I restore the

command
bars in Excel. I've managed to delete them all while playing about
with
the following code.

Each time I open Excel there is no longer any menus.
I'm in a right panic at this time :eek:

Sub Change_Cell_Menu()
Dim IDnum As Variant
Dim N As Integer
Dim Ctl As CommandBarControl

'Set Enabled to False for all the controls
For Each Ctl In CommandBars("Cell").controls
On Error Resume Next
Ctl.Enabled = False
On Error GoTo 0
Next Ctl
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

Any help is urgently needed.

-Joe


--
nrussell
-------------------------------------------------------------------

-----
nrussell's Profile:
http://www.excelforum.com/member.php...o&userid=23731
View this thread:
http://www.excelforum.com/showthread...hreadid=374054




Hi,

This might do it, but use at your own risk!


Sub ResetAll ()

For Each MyBar in Application.Commandbars

MyBar.Enabled = True
MyBar.Reset

Next

End Sub




HTH,

Alan.



Ron de Bruin

Hi nrussell

I have this lines on my site to <g

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



"nrussell" wrote in message
...

Okay,

This may sound like a dumb question but how do I restore the command
bars in Excel. I've managed to delete them all while playing about with
the following code.

Each time I open Excel there is no longer any menus.
I'm in a right panic at this time :eek:

Sub Change_Cell_Menu()
Dim IDnum As Variant
Dim N As Integer
Dim Ctl As CommandBarControl

'Set Enabled to False for all the controls
For Each Ctl In CommandBars("Cell").controls
On Error Resume Next
Ctl.Enabled = False
On Error GoTo 0
Next Ctl
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

Any help is urgently needed.

-Joe


--
nrussell
------------------------------------------------------------------------
nrussell's Profile: http://www.excelforum.com/member.php...o&userid=23731
View this thread: http://www.excelforum.com/showthread...hreadid=374054




nrussell


Thanks for the ideas but none of them worked. I disabled Excel well and
good! In the end I had to reset my profile :(

That did teach me a very important lesson on how damaging Macros really
are. Never going to play about with that code again!

-Joe


--
nrussell
------------------------------------------------------------------------
nrussell's Profile: http://www.excelforum.com/member.php...o&userid=23731
View this thread: http://www.excelforum.com/showthread...hreadid=374054



All times are GMT +1. The time now is 05:22 PM.

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