How do I recover this VBA Project? Excel Error message: "Removed Part: /xl/vbaProject.bin part."

Tom Winchester picture Tom Winchester · Feb 26, 2011 · Viewed 42.6k times · Source

I've seen related posts on other forums about this (see: http://www.mrexcel.com/forum/showthread.php?t=372534), but I've attempted everything that I've found with no success.

Here's the situation: I have a .xlsm workbook (named 'PTPro.xlsm') that contains around 2000+ lines of VBA code in a Module and 6-7 large UserForms each with their own giant chunk of code. Earlier today, I was working on the project and everything was going just fine. I saved, closed, and opened the file about 20 times total throughout the process. Never once did I receive an error message. It should be noted (in case it's important) that I was saving directly to a flash drive from Excel.

When I brought the project home this evening, I attempted to open it to make a quick change. This is when I received the following series of error messages:

  1. "Excel found unreadable content in 'G:\PTPro\PTPro.xlsm'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes."

  2. After clicking yes, a new dialog box opens with the following error message:

  3. "Excel was able to open the file by repairing or removing the unreadable content. Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))"

  4. My only option at this stage is to click 'Close' which loads the workbook.

  5. When I hit Alt+F11 to view the VBA editor, the entire VBA project (modules, userforms, macros, etc.) is COMPLETELY GONE!!!

I've followed all of the steps that I can find, including changing the Excel defaults to enable all macros and to tring to open the file on 4 different computers (both from the hard drive and from the flash drive). The only thing that I can think of that I haven't tried yet is opening the file on the computer that I was working on today (which is a shared computer in a public computer lab, by the way). This won't be an option until Monday.

It should be noted that there are several sub-workbooks that include intermediate steps required by my application that were opened and closed frequently throughout the day, as well. They are all working just fine.

If you have ANY experience with this problem, or ANY ideas as to how I might recover the code I've written, I would be EXTREMELY grateful!!!

THANK YOU!!!

Answer

indrap picture indrap · Oct 13, 2011

I have similar problem when i try to run my VBA script inside client PC.

The problem is because the client PC doesn't install Microsoft Office Visual Basic Application. By running office setup then add Visual Basic Application Feature, the script successfully running.