HELP PLEASE!!! I messed up my Excel.

Mister H

Well-known Member
Joined
Mar 6, 2002
Messages
1,507
Hi All:

I was playing around and was trying to help someone out on the board in regards to this Post: "Formula bar won't disappear"

I put the code below in a NEW Workbook and ran it and now I have messed up MY own Excel. :oops:

Life as a VBA "EXTREME" Rookie is not always fun...

ANYWAY I am hoping that someone can get me back up and running.

Code placed in ThisWorkbook:

Code:
Private Sub Workbook_Open()
    Call HideMenus
    If Worksheets("Input").Range("B5").Value = "" _
        Then Worksheets("Input").Range("B5").Value = (Date - 1)
    With ActiveWindow
        .DisplayGridlines = False
        .DisplayHeadings = False
        .DisplayWorkbookTabs = False
        .DisplayHorizontalScrollBar = False
    End With
End Sub

This code was placed in Module 1:

Code:
Sub HideMenus()
    Dim cbars As CommandBar
    Application.ScreenUpdating = False
    For Each cbars In Application.CommandBars
        cbars.Enabled = False
    Next
    With Application
        .CommandBars("Worksheet Menu Bar").Enabled = False
        .DisplayFormulaBar = False
        .DisplayStatusBar = False
        .CommandBars("Standard").Visible = False
        .CommandBars("Formatting").Visible = False
        .Caption = "Konove Night Audit.xls"
        .ScreenUpdating = True
    End With
    ActiveWindow.Zoom = 93
    Application.DisplayFullScreen = True
End Sub
So as I say I ran the code and closed the Workbook and then as the code states all my toolbars etc were gone... SO after I FINALLY figured out how to get back into VBA (Right Clicking on TABS brought up nothing and there is Tools/Macro Bar (Wrong terminology sorry) to get me to VBA. Anyway I revered the code (I think) and ran it again and most things that I know of came back but NOT my main bar that I use to Open, Save, View, Tool Options, Help Menu. I am not sure what this bar is actually called but I hope you know what I am referring to. Here is the REVERES ED code I ran:

Code:
Private Sub Workbook_Open()
    Call HideMenus
    If Worksheets("Input").Range("B5").Value = "" _
        Then Worksheets("Input").Range("B5").Value = (Date - 1)
    With ActiveWindow
        .DisplayGridlines = True
        .DisplayHeadings = True
        .DisplayWorkbookTabs = True
        .DisplayHorizontalScrollBar = True
    End With
End Sub

Code:
Sub HideMenus()
    Dim cbars As CommandBar
    Application.ScreenUpdating = False
    For Each cbars In Application.CommandBars
        cbars.Enabled = True
    Next
    With Application
        .CommandBars("Worksheet Menu Bar").Enabled = False
        .DisplayFormulaBar = True
        .DisplayStatusBar = True
        .CommandBars("Standard").Visible = True
        .CommandBars("Formatting").Visible = True
        .Caption = "Konove Night Audit.xls"
        .ScreenUpdating = True
    End With
    ActiveWindow.Zoom = 100
    Application.DisplayFullScreen = True
End Sub

SORRY for the Long Post... Can anyone assist?

THANKS,
Mark
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try running this

Code:
Sub a()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
End Sub
 
Upvote 0
THANKS VoG II... Your a Lifesaver :biggrin: :oops: :biggrin:

Live and LEARN :LOL:

THANKS AGAIN...

Have a GREAT day,
Mark
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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