Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Excel Corrupt Require Module Recovery

1 view
Skip to first unread message

Taysh

unread,
Jun 21, 2000, 3:00:00 AM6/21/00
to
Does anyone have info on recovery of modules in a corrupt file. None of
the excelfix or excelrecovery sites work with modules or any other of the
suggestions re: corrupt files. File is Excel 97 running on Win NT. I
believe it may be an OLE object problem causing the file to crash on
opening as it cant seem to load the objects.


--
Posted via CNET Help.com
http://www.help.com/

Julian Milano

unread,
Jun 21, 2000, 3:00:00 AM6/21/00
to
Hello Taysh,

I heard a rumour that if you changed the XL workbook extention, to say TXT
or PRN or CSV or something, you could use Word to import the file, clean it
up, and extract the code.

Pls let me know if this works.

--

Julian Milano


"Taysh" <Ta...@hotmail.com> wrote in message
news:sl034co...@corp.supernews.com...

llaw

unread,
Jun 21, 2000, 3:00:00 AM6/21/00
to
' Open MS Word. Invoke the Visual Basic Editor (ALT-F11).
' Copy and paste the following code into a module.
' Change the following file names in the code to something you want. The
first ("XL.Workbooks.Open FileName:=" in the code) is the path and file name
of the
' corrupted spreadsheet file. The second ("C:\temp\vbe_" in this example)
includes
' the path and folder to put the exported contents of the corrupted
spreadsheet.
'
' Establish a reference to the Microsoft Excel 9.0 Object Library: Tools,
References,
' check the box next to this entry.
' Execute the code (cursor in module; press F5).
' if you get an File Open error message, click Debug, then Continue.
' When the code has executed, look in the Export File Name you indicated.
' You'll see a bunch of *.txt file.
' Open a new Excel spreadsheet.
' File/Import each of these txt files.
' Excel will rename the txt files to the original module name, although you
may have to
' copy the contents of ThisWorkbook from a class module into the actual
ThisWorkbook
' folder.
' Save the renewed spreadsheet. You're done!

Sub Recover_Excel_VBA_modules()

Dim XL As Excel.Application
Dim XLVBE As Object
Dim i As Integer, j As Integer

Set XL = New Excel.Application

XL.Workbooks.Open FileName:="h:\CR - Portfolio Template.xls"

Set XLVBE = XL.VBE

j = XLVBE.VBProjects(1).VBComponents.Count

For i = 1 To j
Debug.Print XLVBE.VBProjects(1).VBComponents(i).Name
XLVBE.VBProjects(1).VBComponents(i).Export FileName:="C:\temp\vbe_"
& (100 + i) & ".txt"
Next

XL.Quit
Set XL = Nothing

End Sub


Andrew Baker

unread,
Jun 25, 2000, 3:00:00 AM6/25/00
to
You could try the workbook rebuilder on my site and its free.


Regards,

Andrew Baker

www.vbusers.com

llaw <ll...@hciww.com> wrote in message news:#YUBUu32$GA.170@cppssbbsa05...

Taysh

unread,
Jun 27, 2000, 3:00:00 AM6/27/00
to
Thanks for everyones suggestions unfortunately they didn't work. The
macro to be used in Word did work but it only exported some 12 of the 20
components and none unfortunately were modules.

If anyone has any other ideas let me know.

Thanks again!

0 new messages