Works too well - Hide toolbar Macro

L

LiAD

Hi,

I was given a macro on this forum to hide all the toolbars and menus. I
used it on the file I wanted and it works perfectly. The macro was entered
using the right click on the top left of the screen, not on the sheet tabs
section.

However now I've changed computers and I applied the macro again after
making some updates to the file, (i keep a master file without the macro on
my harddrive so that i can update and then add the macro before saving it for
general use), but this time it has hidden the menus on every excel file on my
computer - even new files that I open.

Now I am completely stuffed!

How can I
- stop this activating on all excel files?
- remove it from the file I want?

Thanks
LiAD

I have attached the macro I am using for reference.

Private mFormulaBar

Private Sub Workbook_BeforeClosex()
Dim oCB As CommandBar
For Each oCB In Application.CommandBars
oCB.Enabled = True
Next oCB

Application.DisplayFormulaBar = mFormulaBar
End Sub

Private Sub Workbook_Open()
Dim oCB As CommandBar
For Each oCB In Application.CommandBars
oCB.Enabled = False
Next oCB

mFormulaBar = Application.DisplayFormulaBar
Application.DisplayFormulaBar = False
End Sub
 
B

Bob Phillips

In the immediate window in the VBIDE try

Application.CommandBars(1).Enabled=True

You should be able to use Customize to retrieve the reset then.
 
D

dk

Its because:

"Private Sub Workbook_BeforeClosex() "

should have been :

Private Sub Workbook_BeforeClose()
 
L

LiAD

Thanks.

This gets me the tool bars back but I still cannot right click on the top
left to re-insert theworkbook event code again.

Is it possible to retrieve this option?

Thanks
 
L

LiAD

Is this what has disabled all files and not just the one I wanted or does
this make it difficult to undo?

Thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

RunWhen error 4
Hide the close X in excel 2
Code Stopped 2
Impossible? - Close code 1
Time close and save 0
Close help 2
Help! Combine Macros 2
Unable to disable macro 11

Top