Managed to royally screw up Excel!

ExcelTryhard

New Member
Joined
Nov 13, 2015
Messages
2
I've been fiddling and learning all about the wonders of VBA recently and have been loving it, right up until I came across the concept of hiding toolbars etc.

I've managed to lose the ability to right click in excel which was kind of what I was trying to do but I've done it a bit too permanently and can't get that feature back!

Using the following code, I can run this macro manually and get my right click back but as soon as I close the workbook (Saving it) and try to reopen any workbook or new blank book, I go back to having no right click functionality :confused:

The thing that is really getting to me is that my workbook_open() (or Auto_open / workbook_activate) scripts no longer work either, even just a simple msgbox doesn't appear so I really have no idea how this is happening?!

Edit: The workbook_open is now working so I can sort it that way but at the moment there still seems to be a mischievous bit of code or a setting somewhere as even if I open up Excel with a new workbook I can't right click... And its Excel 2013 Im using

Code:
[COLOR=#333333]With Application[/COLOR]
[COLOR=#333333].DisplayFormulaBar = True[/COLOR]
[COLOR=#333333].CommandBars("Worksheet Menu Bar").Controls("Tools").Controls("Options...").Enabled = True[/COLOR]
[COLOR=#333333].CommandBars("Worksheet Menu Bar").Controls("View").Controls("Formula Bar").Enabled = True[/COLOR]
[COLOR=#333333].CommandBars("Worksheet Menu Bar").Controls("View").Controls("Toolbars").Enabled = True[/COLOR]
[COLOR=#333333].CommandBars("Toolbar List").Enabled = True[/COLOR]
[COLOR=#333333].CommandBars("Worksheet Menu Bar").Controls("Tools").Controls("Customize...").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("File").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("Edit").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("View").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("Worksheet Menu Bar").Controls("Insert").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("Format").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("Tools").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("Data").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("Window").Enabled = True[/COLOR]
[COLOR=#333333]Application.CommandBars("Help").Enabled = True[/COLOR]
[COLOR=#333333]For Each a In Application.CommandBars[/COLOR]
[COLOR=#333333]Application.CommandBars(a.Name).Enabled = True[/COLOR]

[COLOR=#333333]Next[/COLOR]
[COLOR=#333333]End With[/COLOR]

The only other code I've got is in a module and I'm 99.9% sure that that can't be affecting it...

Code:
Sub Linktoworksheets()Dim sh As Worksheet
Dim cell As Range
Dim i As Integer
Dim j As Integer
'Add sheet links
    Range("B3:B1000").ClearContents
    Range("B3").Select
For Each sh In ActiveWorkbook.Worksheets
    If ActiveSheet.Name <> sh.Name Then
        ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
        "'" & sh.Name & "'" & "!B3", TextToDisplay:=sh.Name
        ActiveCell.Offset(1, 0).Select
    End If
Next sh
End Sub


Sub SortSheets()


'Sort sheets alphanumerically


   For i = 1 To Sheets.Count
      For j = 1 To Sheets.Count - 1


            If UCase$(Sheets(j).Name) < UCase$(Sheets(j + 1).Name) Then
               Sheets(j).Move After:=Sheets(j + 1)
            End If
         
      Next j
   Next i
End Sub


Sub NewSheet()
    Sheets("Template").Select
    Sheets("Template").Copy Before:=Sheets(3)
End Sub
 
Last edited:

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hello and welcome to the board!

Maybe "Reset" like so:

Code:
Public Sub Test()

'Reset CommandBars individually
Application.CommandBars("Edit").Reset

'Reset all CommandBars
Dim oCommandBar As CommandBar

For Each oCommandBar In Application.CommandBars
    If oCommandBar.BuiltIn Then
        Debug.Print oCommandBar.Name
        oCommandBar.Reset
    End If
Next oCommandBar

End Sub
 
Upvote 0
Thanks, I ended up deleting one of the registry files (HKEY_CURRENT_USER\Software\Microsoft\Office|14.0\Excel\Options if anyone has this issue in the future) and that sorted it for me. Was so strange that I just could not get it to reset through excel :eek:
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,382
Members
448,889
Latest member
TS_711

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top