0

I was using a excel file with macro (*.xlsm), and after a entire day without saving I saved as a common excel file (*.xlsx) and closed everything, and now I have a old xlsm and a new xlsx.

There is any way I can recover the code? I really make a lot of changes and as I saved the file in xlsx I don't think that excel will give me a early version of my coded file.

  • 3
    Sorry mate, it's gone now - Excel throws away any macros when you save as an .xlsx. Live and learn! – dwirony Jun 21 '18 at 20:32
  • 3
    I afraid you're out of luck. Saving is kind of like voting, you want to do it early and you want to do it often. – cybernetic.nomad Jun 21 '18 at 20:32
  • One thing I do is copy versions of a macro I'm working on and paste into a text file - they paste back fine. Sorry, been there and feel your pain. – Solar Mike Jun 21 '18 at 20:34

1 Answers1

0

Not answering your question (you already got the bad news...) but I have this code in my personal Macro Workbook and linked to an icon on the Excel Quick Access Toolbar:

Public Sub SaveSnapshot()

    Dim fso As New Scripting.FileSystemObject
    Dim wb As Workbook, p As String
    Set wb = ActiveWorkbook

    p = wb.Path & "\Snapshots"

    If Not fso.FolderExists(p) Then fso.CreateFolder (p)

    wb.Save
    wb.SaveCopyAs p & "\" & Format(Now, "yyyymmdd_hhmmss") & "_" & wb.Name

End Sub

I get in the habit of clicking that icon regularly...

Tim Williams
  • 154,628
  • 8
  • 97
  • 125