PDA

View Full Version : restore excel to default



lior03
07-09-2007, 03:39 AM
hello
i wanted tio restore excel to default positon.namely delete all custom icones & custom toolbars and shortcut menues.this is what i came up with
shortcut menu....

Sub deleteitemshortcut()
On Error Resume Next
Dim NewItem As CommandBarControl
If Not NewItem.BuiltIn Then
NewItem.Visible = False
End If
End Sub


toolbars...........

On Error Resume Next
Dim ocb As CommandBar
For Each ocb In Application.CommandBars
If Not ocb.BuiltIn Then
ocb.Reset
ocb.Delete
ocb.Enabled = False
ocb.Visible = False
End If
Next ocb


i did not got satisfactory result.
not all icones and shortcuts had been deleted why?
thanks

Simon Lloyd
07-09-2007, 04:30 AM
Just look for a file called excel.xlb this is a restore file on your PC open this file and everything should be back to normal!

unmarkedhelicopter
07-09-2007, 07:18 AM
Sucess is measured by others, achievement is measured by you...so if you achieve success who holds the tape meaure?

Well, obviously someone has to hold one end of the tapemesure and you get to hold the other. It's a team thing !!! ;)

lior03
10-21-2007, 11:13 PM
hello
i came up with this:

On Error Resume Next
Dim cm As CommandBar
For Each cm In Application.CommandBars
Select Case cm.Enabled
Case cm.BuiltIn
cm.Reset
Case Not cm.BuiltIn
cm.Delete
End Select
Next


the macro works - excel return to it's default setting ,but a msgbox appears with error number 5.why?
thanks

lior03
10-22-2007, 07:15 AM
hello
what is wrong with this double select case:.

Dim reply As VbMsgBoxResult
reply = MsgBox("sure to restore? press: ok to activate, no to see code", vbQuestion + vbYesNoCancel, "Attention!!!")
On Error Resume Next
Select Case reply
Case vbYes
Dim cm As CommandBar
For Each cm In Application.CommandBars
Select Case cm.Enabled
Case cm.BuiltIn
cm.Reset
Case Not cm.BuiltIn
cm.Delete
Case vbNo
Application.Goto "restorenow"
Case vbCancel
Exit Sub
End Select
Next
End Select
End Sub

thanks

lucas
10-22-2007, 08:04 AM
i wanted tio restore excel to default positon.namely delete all custom icones & custom toolbars and shortcut menues

The best way to do this is not with code....search your hard drive for the excel.xlb and rename it to excel-old.xlb and then open excel...
Be sure to back it up first though as I have shown above.

mine is located here:
F:\Documents and Settings\Main\Application Data\Microsoft\Excel