Protection Macro Causes All Workbooks to Be Locked

J

JG

I've posted this before, just forgot the answer...sorry.

One of our programmers created a macro to prevent insert option, save as
option etc. for a specific workbook.

The macro has, however, now infected all workbooks. Even if you create a
brand new workbook, all of these options are grayed out.

I know there is a reset code. Could someone share it with me. Thanks.
 
J

Javed

I've posted this before, just forgot the answer...sorry.

One of our programmers created a macro to prevent insert option, save as
option etc. for a specific workbook.

The macro has, however, now infected all workbooks.  Even if you createa
brand new workbook, all of these options are grayed out.

I know there is a reset code.  Could someone share it with me.  Thanks.

Try the fllowing

Dim cb as commandbar

for each cb in application.commndbars
 
J

Javed

Try the fllowing

Dim cb as commandbar

for each cb in application.commndbars
if not cb.builtin then cb.reset
next cb
 
P

Peter T

Did you try searching for the for your post and the answer you were given.
If you can't find it give some more details and I will try to find it for
you. If between us we still can't find it, I'll suggest some possible
reasons your all your workbooks are locked. But as there are a number of
reasons much better to find the one you already know will is relevant for
your situation.

Regards,
Peter T
 
J

JG

I did try searching but since this originally happened in late 2008, early
2009, I haven't found it.

The problem is that the programmers in my office write macros meant for
specific spreadsheets. The macros do various things from disabling built-in
menus, to preventing users from being able to insert rows and columns, use
the save as option, etc.

I am the one who usually gets to test the spreadsheets and try to crack them.

Sometimes what happens is that the macros get to be too good as they seem to
affect any workbook, new or existing, that I open in Excel thereafter.
Meaning if I open a totally unrelated workbook that does not use those
macros, I still cannot use save as, insert, etc.

When I originally posted this before, someone gave me a code that gets
inserted into the VB editor that would reset everything.

I'm not a programmer and know very little about the VB end of Excel, thus I
really appreciate your help.

P.S. I've seen this happen in Excel 2000 and 2003, but haven't experienced
it in 2007 yet.
 
P

Peter T

There's no "setting" in the VBE that would lock all projects.

Search for a file named "book.xlt" located in the XLSTART folder. If someone
has saved a template there with that name (or language dependant alternative
name) that's had it's project locked all new workbooks will start with same.
Simply move the file to a different location.

If that doesn't prevent new workbooks opening with their projects locked -

Uninstall addins one by one until new workbooks open unlocked. In theory
it'd be possible for an addin to trap application level events. Ie when a
new workbook is opened in Excel an "event" gets triggered that could go on
to lock a new workbook, or any other workbook it feels like locking say
subject to part of its name. Personally I have never come across such an
addin but as I say it would be possible.

Regards,
Peter T
 
J

JG

Peter,

1. The XLSTART folder is empty. Yes, my computer it set to show all hidden
files.

2. There are no add-ins installed.

Any other suggestions?

Thanks.
 
P

Peter T

To re-clarify, are you saying when you add a new workbook its vbProject is
automatically locked?

To avoid any misunderstanding -

close all Excel instances
start a new instance
you should see "Book1", right?
open the VBE, Alt-F11
In project explorer, the top left panel (if necessary ctrl-R), right-click
on Book1
click "VBAProject Properties..."
Are you prompted for a password ?

If the project is NOT locked but all the items in VBE's Insert menu are
greyed, that could have been done as a one-off by a macro - if so
In the VBE, customize toolbars (rt-click a black area on a toolbar)
activate the Toolbars tab
select MenuBar
Reset

If that works, close & restart Excel and look again, ?

Regards,
Peter T
 
J

JG

No, the VB project is not locked.

The save, save as and insert (as in columns and rows) are locked out.

I've already tried resetting the toolbars and deleting the xlb file, but
neither work.
 
P

Peter T

OK, so nothing to do with Locked workbooks then?

Try this

Close all Excel
Try renaming this registry key
HKEY_CURRENT_USER\Software\Microsoft\VBA\6.0\Common

Change Common to say CommonOld

Restart Excel, open the VBE, add a new module

A new 'Common' should be created

If still not cured advise which Office version and if more than one Office
installed

Regards,
Peter T
 
P

Peter T

Just read your last message again.

"The save, save as and insert (as in columns and rows) are locked out"

Now I am really confused, The insert menu etc, are you talking about Insert
in the VBE or in Excel,

Before I thought you meant the Insert menu in the VBE, which would make
sense if the project is locked. But now you appear to be talking about
Insert in Excel. Carefully describe what you mean in a way that avoids
misunderstanding.

Also reconfirm there is no problem with workbooks being locked, as implied
by the subject of this thread.

Oh, and if there's no problem with the VBE ignore what I said about the
registry hack.

Regards,
Peter T
 
J

JG

I apologize if my wording mislead you...

It is Excel that is locked. In any worksheet, I cannot insert a row or a
column. I also cannot save the worksheet, or choose to save it as another
file.
 
P

Peter T

Reading back from the beginning maybe it was my fault in jumping to
conclusions. Let's start again.

You say the you deleted the xlb, need to be sure you deleted the right xlb,
follow this -

Customize the toolbars in some obvious way
Close all instances of Excel
Delete or rename the xlb again
Start Excel
Is the last toolbar customization still there.
If yes, you didn't delete the right xlb file

mine Excel2003 xlb is here
C:\Documents and Settings\<username>\Application
Data\Microsoft\Excel\Excel11.xlb

If no (recent customization gone), are your other menus OK now
If no it must be due to some workbook (or addin or ComAddin) disabling the
menus

What's the situation when you start Excel with a new workbook but nothing
else loaded?

Which version of Excel?

Regards,
Peter T
 

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

Top