D
Devin Linnington
Hi,
I screwed up, bigtime, and now I cannot open one of my workbooks. However, I
really want to recover the project stored in it. All I need to do is somehow
extract that data from the workbook without opening it. I have tried the
Office tool 'recover data' but when it repairs the file it deletes the macros
(yes, they are that screwed up ). I found a website that offers a 'copy
all modules to another workbook' program for VBE, but trying it in the VBA
editor from excel doesn't work. If the program did work I think it would
solve my problem. Here is the code from that website:
Sub CopyAllModules()
Dim FName As String
Dim VBComp As VBIDE.VBComponent
With Workbooks("Book2")
FName = .Path & "\code.txt"
If Dir(FName) <> "" Then
Kill FName
End If
For Each VBComp In .VBProject.VBComponents
If VBComp.Type <> vbext_ct_Document Then
VBComp.Export FName
Workbooks("book1").VBProject.VBComponents.Import FName
Kill FName
End If
Next VBComp
End With
End Sub
It is the 'VBIDE.VBComponent' that doesn't work (not registered in VBA?) and
I think that the 'VBComponents' doesn't work either. The website is
http://www.cpearson.com/excel/vbe.htm .
Can someone help me recover my project?
Thanks ahead of time for the help (once again)
Devin L.
I screwed up, bigtime, and now I cannot open one of my workbooks. However, I
really want to recover the project stored in it. All I need to do is somehow
extract that data from the workbook without opening it. I have tried the
Office tool 'recover data' but when it repairs the file it deletes the macros
(yes, they are that screwed up ). I found a website that offers a 'copy
all modules to another workbook' program for VBE, but trying it in the VBA
editor from excel doesn't work. If the program did work I think it would
solve my problem. Here is the code from that website:
Sub CopyAllModules()
Dim FName As String
Dim VBComp As VBIDE.VBComponent
With Workbooks("Book2")
FName = .Path & "\code.txt"
If Dir(FName) <> "" Then
Kill FName
End If
For Each VBComp In .VBProject.VBComponents
If VBComp.Type <> vbext_ct_Document Then
VBComp.Export FName
Workbooks("book1").VBProject.VBComponents.Import FName
Kill FName
End If
Next VBComp
End With
End Sub
It is the 'VBIDE.VBComponent' that doesn't work (not registered in VBA?) and
I think that the 'VBComponents' doesn't work either. The website is
http://www.cpearson.com/excel/vbe.htm .
Can someone help me recover my project?
Thanks ahead of time for the help (once again)
Devin L.