ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Deleted Macros? (https://www.excelbanter.com/excel-discussion-misc-queries/35193-deleted-macros.html)

Losse

Deleted Macros?
 

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?


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


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


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=386932


Losse


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


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


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... are%22&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


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=386932


Losse


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


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


Losse


My macros were all saved to the PERSONAL.XLS anyways...


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


Losse


I tried using the Restoration program, but I have no idea what name to
search for.


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


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.




Losse wrote:

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

--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


--

Dave Peterson

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.



Losse wrote:

My macros were all saved to the PERSONAL.XLS anyways...

--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


--

Dave Peterson

Losse


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


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


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.)

Losse wrote:

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

--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


--

Dave Peterson

Losse


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


--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


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!



Losse wrote:

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

--
Losse
------------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...o&userid=24813
View this thread: http://www.excelforum.com/showthread...hreadid=386932


--

Dave Peterson


All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com