View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lisa Lisa is offline
external usenet poster
 
Posts: 328
Default Unable to disable macro

Hi, I have created a macro in a worksheet, to disable the menu toolbars etc.
I had also protected the sheet (which I've since removed).

The *very* frustrating problem is, any other workbook I open now (either new
or existing) prevents me from rightclicking on the mouse to insert rows
columns etc.

I am presuming it is something to do with the macro I created, which looks
like as below, but I want to switch everything off and return back to normal
Excel operation when this workbook is closed. Can anyone point me in the
right direction - perhaps its an excel option somewhere I simply need to
switch off?

Option Explicit

Private mFormulaBar

Private Sub Workbook_BeforeClose(Cancel As Boolean)
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