Deleted Macros?

L

Losse

I was messing around in Excel and accidentally deleted all of my macros
I think. I used:

Application.DisplayAlerts=False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
ThisWorkbook.Close False

Is there anyway I can get them back?
 
D

dominicb

Good evening Losse

Unfortunately it won't be simple, unless you had a back-up. As you
have discovered, the kill command is a bit more brutal than pressing
delete from Windows - which sends a file to the recycle bin.

However, all is not lost, because you have deleted the file, not
removed the macro and saved the macro-free file back over itself. You
may be able to recover the file using an undelete utility. Try
searching Google for just that.

HTH

DominicB
 
L

Losse

I see only expensive programs for undeleting corrupted macros. Were min
simply corrupted or were they deleted
 
D

dominicb

Hi Losse

Your macros are saved as part of the file. The file has been deleted,
therefore the contents of the file and your macros have gone. If you
can undelete the file - and programs are available that will do this -
your data and macros can be recovered intact.

http://www.google.co.uk/search?hl=en&q="undelete+utility"+++"freeware"&meta=

this link is a Google page searching for freeware undelete utilities.
I haven't used an undelete facility since Nuts'n'Bolts was available,
so can't recommend one. You could try asking here for a good freeware
utility (unless someone reading this forum can recommend one...?):

http://www.computerforum.com/forumdisplay.php?f=17

Good luck

HTH

DominicB
 
L

Losse

I belive I killed "Book1." How am I supposed to find this? It was neve
saved, and that is the default name to Excel worksheets
 
D

Dave Peterson

If it was never saved, then you couldn't have "killed" it (kill deletes a file
on disk).

But since that code closed the workbook, too, it's gone and so are the macros in
it.
 
D

Dave Peterson

If your macros were in personal.xls and you remembered to save personal.xls when
you closed excel, then they should still be there.

If they're not, I bet you said no to updating personal.xls.
 
L

Losse

My macros are normally saved to the PERSONAL.XLS. I tried to recover i
using the Restoration program, but it couldn't find it. Is there reall
nothing I can do? I spent weeks perfecting and building those macros..
 
D

Dave Peterson

Does that mean you can't find personal.xls or you can't find the new macros in
personal.xls?

If you can find personal.xls, but the new macros are gone, then they're gone.

If you can't find personal.xls, then maybe using windows start button|search
(look through hidden folders and for hidden files--just in case) may help.

If you ran this code from personal.xls project, I hope you have a backup.
Because I think you're out of luck.

Application.DisplayAlerts=False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
ThisWorkbook.Close False

====
Remember to backup personal.xls (or any other file) before you start
experimenting. (too late for this time, though.)
 
L

Losse

That's correct. The PERSONAL.XLS is gone completely. Yes, I did run cod
from a macro in the PERSONAL.XLS. Why would it have killed the macro
instead of book1? I have no idea why killing the current file woul
have deleted all of my macros
 
D

Dave Peterson

Your code:

Application.DisplayAlerts=False
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName
ThisWorkbook.Close False

ThisWorkbook means the workbook that contains the code.

If only you had used Activeworkbook!
 
Top