+ Reply to Thread
Results 1 to 16 of 16

How can i export my VBA code from a corrupt file

  1. #1
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    How can i export my VBA code from a corrupt file

    Hi,

    I spent all friday afternoon writing a new code and then excel decided it wanted to to refresh the sql data which cause too much data and the file to corrupt, i can now not open the file at all and excel cannot repair it.

    All i want is to retrieve the vba code, is there a way to do this?

    There are no restore points either as it was a new file i was working on that afternoon

    Hope you can help

    Many Thanks

    SImon

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How can i export my VBA code from a corrupt file

    what file format is it? if it's an xlsm try renaming it to .zip and then extract the vbaproject.bin to a new blank xlsm file (also converted to .zip)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: How can i export my VBA code from a corrupt file

    Thanks, how do i extract the vbaproject.bin?

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How can i export my VBA code from a corrupt file

    after renaming the file double click to open it as a folder in explorer then find the vbaproject.bin file and copy it to another folder

  5. #5
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: How can i export my VBA code from a corrupt file

    I have renamed it as just .zip but when i double click it it still opens in excel (oh and yeh it is a xlsm file)

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How can i export my VBA code from a corrupt file

    if you renamed it as .zip with no .xlsm extension and it still opens in excel there is something wrong with your file association. excel should never try and open zip files. are you sure you removed the .xlsm extension?

  7. #7
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: How can i export my VBA code from a corrupt file

    oh ok, dont want to sound stupid but how do you remove the .xlsm extension?

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How can i export my VBA code from a corrupt file

    does your windows explorer show file extensions or only the name? also which version of windows are you using?

  9. #9
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: How can i export my VBA code from a corrupt file

    It only shows the name and im on windows 8 pro

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How can i export my VBA code from a corrupt file

    I am not at a Win8 machine right now but I think you simply open Windows Explorer, go to "View", click the Options button > "Change folder and search options" then scroll to "Hide extensions for file types if known" and uncheck it

  11. #11
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: How can i export my VBA code from a corrupt file

    ok i managed to sort the file extension and have access to the vbproject.bin, when i right click on it and select Extract, how do i select the new Book1.zip file i created as i cannot see it

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How can i export my VBA code from a corrupt file

    you can't extract it there directly. extract to another folder temporarily, then you can copy and paste it into the other zip file

  13. #13
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: How can i export my VBA code from a corrupt file

    ok done that, how do i now get that back into excel to read it?

    thanks for this btw

  14. #14
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How can i export my VBA code from a corrupt file

    rename the second file back to .xlsm and then open it as normal-with fingers crossed the project wasn't corrupt ;-)

  15. #15
    Registered User
    Join Date
    02-11-2013
    Location
    Guernsey
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: How can i export my VBA code from a corrupt file

    IT WORKED...... i just renamed it as .xlsm

    THANK YOU SO MUCH

  16. #16
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How can i export my VBA code from a corrupt file

    you're welcome :-)

    please don't forget to mark the thread solved (click the 'thread tools' link at the top, then 'mark solved')

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Chart.export creates corrupt files randomly
    By triods358 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-07-2014, 08:29 PM
  2. Export KML file to Google Maps with VBA code
    By Pelusa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2013, 09:30 AM
  3. VBA Code to export to .txt file - Needs tweaking
    By tomjackuk in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-08-2012, 09:51 AM
  4. Code to export data to a .dat file
    By aadarsh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2010, 04:13 AM
  5. [SOLVED] Import VBA Code in Excel-File ? (Export VBA Code to file)
    By Matthias Pospiech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1