Problem with locked file

A

Alan M

I have a workbook with VBA programming in which caused Excel to close for
some reason. Now when I go to re-open the workbook and select either enable
macros or disable macros at the prompt. I receive an error message which says
the workbook is " locked for editing' and can only be opened as read-only. If
I then continue it causes Excel to crash and close down.

Can anyone advise how I can recover this workbook and attached VBA code
please?
 
D

Dave Peterson

You could start here at Debra Dalgleish's site:
http://contextures.com/xlfaqApp.html#ReadOnly
and
http://contextures.com/xlfaqApp.html#AlreadyOpen



If excel crashed, you could have a hidden instance of excel still running that's
causing the trouble.

Close all the visible instances of excel.
Start windows task manager
alt-ctrl-delete will get you to in winxp (home). You may have to choose task
manager in other versions (Vista??) of windows.

You should see no instance of Excel.exe on the Applications tab. If you do, you
haven't closed all the visible instances. Do that before continuing.

Now look at the Processes tab.
Look for Excel.exe
and end the process.

Then close windows task manager and restart excel and test it out. Doing this
won't give you a prompt to save any work.

When I'm hiding excel and testing, I want a method of showing those instances of
excel.

I use a .vbs file with this in it:

dim myXL
On Error Resume Next
Set myXL = GetObject(, "Excel.Application")
If Err.Number = 429 Then
msgbox "Excel is not running"
else
myxl.visible = true
end If
On Error GoTo 0
Set myxl = nothing


You can copy this (starting with Dim and ending with Set myxl = nothing) and
paste it into NotePad.

Then save the file as UnHideExcel.VBS in a nice safe location on your pc.

Then you can close any visible instances of excel
run that .vbs file
close that newly shown instance of excel

run that .vbs file
close the next newly shown instance of excel

(do those last two steps until you get the "excel is not running" message.)
 

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