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

Signature
nrussell
Bob Phillips - 25 May 2005 23:41 GMT
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

Signature
HTH
RP
(remove nothere from the email address if mailing direct)
> Okay,
>
[quoted text clipped - 29 lines]
>
> -Joe
dominicb - 25 May 2005 23:44 GMT
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
Alan - 25 May 2005 23:52 GMT
"nrussell" <nrussell.1plyn9_1117059011.0078@excelforum-nospam.com>
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
[quoted text clipped - 31 lines]
>> nrussell
>> -------------------------------------------------------------------
-----
>> nrussell's Profile:
>> http://www.excelforum.com/member.php?action=getinfo&userid=23731
>> View this thread:
>> http://www.excelforum.com/showthread.php?threadid=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.
nrussell - 26 May 2005 20:19 GMT
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

Signature
nrussell
Ron de Bruin - 26 May 2005 15:48 GMT
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.

Signature
Regards Ron de Bruin
http://www.rondebruin.nl
> Okay,
>
[quoted text clipped - 29 lines]
>
> -Joe