Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
You shoud add the following instruction : Cancel = True in your workbook_beforeclose macro HTH |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Lisa,
In these instances, you must make sure you are reversing all your initial instructions ... It looks like you are missing : Application.DisplayFormulaBar = True HTH |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
....
It could also that you need to replicate all your "back-to-normal" instructions in a Private Sub Workbook_WindowDeactivate(ByVal Wn As Window) macro HTH |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Carim
Thanks for getting back to me. I've added in your suggestions, but I still cant use right click on the mouse for anything. On you last suggestion, I added the Private Sub Workbook_WindowDeactivate(ByVal Wn As Window) but this was only recognised when I trimmed the statement to Private Sub Workbook_WindowDeactivate "Carim" wrote: .... It could also that you need to replicate all your "back-to-normal" instructions in a Private Sub Workbook_WindowDeactivate(ByVal Wn As Window) macro HTH |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Lisa,
Have a go with : Sub Test() Application.CommandBars("Cell").Enabled = True End Sub HTH |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Still no joy on this "Carim" wrote: Hi Lisa, Have a go with : Sub Test() Application.CommandBars("Cell").Enabled = True End Sub HTH |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Disable running of SelectionChange macro when in another macro? | Excel Discussion (Misc queries) | |||
disable user running macro from Tools Macro | Excel Discussion (Misc queries) | |||
unable to record macro | Excel Programming | |||
Unable to run Macro in an Add-in | Excel Worksheet Functions | |||
Disable Macro at open by an external macro | Excel Programming |