Macro Recovery

Sori

New Member
Joined
Jan 3, 2005
Messages
11
Hello,
I have an excel file with lots of macro and forms.As I try to open it, an excel faiulre appears and the file can not be open. I have search in the web for a recovery software but they only recover the sheets nor the VB modules.

Does anyone know how to recover the macros???? I have no problem if i lost the sheets and even the forms.


Thanks in advance and best regards
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

tstevens

New Member
Joined
Sep 1, 2006
Messages
29
Here is some code that worked for me when I was trying to copy a macro from a template. However if your unable to open the file this may not work. If you can give more information, perhaps the exact error your recieving it might help.
Tyler
Code:
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
 

Forum statistics

Threads
1,136,272
Messages
5,674,748
Members
419,525
Latest member
helensesc

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top