help! How do I restore command bars?

  • Thread starter Thread starter nrussell
  • Start date Start date
N

nrussell

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
 
In the immediate window type

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

and then you can do Tools>Customize>Toolbars to get the rest back

--

HTH

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

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

I try not to tinker with my toolbars too mch 'cos it's easy to get int
a pickle and the end result is a bit too permanent for my liking (bu
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

Dominic
 
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.
 
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.
 
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
 
Back
Top