Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an Excel workbook with 14 userforms (each one is for entering a slightly different type of data). The workbook has been behaving strangely--the Excel application quits whenever I close a form. I'd like to copy all of the forms into another workbook, so I can see if it's a corrupted workbook or if the problem is in my code. But in the VBE I can only copy one form at a time. Is there a better way to copy several forms at once?

share|improve this question
    
drag and drop ? –  chris neilsen Dec 29 '11 at 1:59
    
no, that only lets you do one at a time. you can't select all the forms at the same time and then drag them all like you would with files in Windows Explorer. –  sigil Jan 17 '12 at 21:46

1 Answer 1

The best thing I've found for fixing Excel files with corrupted macro binaries is the free VBA Code Cleaner. Installing it will add a Clean Project... option to the VBE Tools menu.

  1. Open the problem file in Excel.
  2. In the VBE, select Tools -> Clean Project...
  3. Select the workbook you want to clean and click OK.
  4. When it is done, recompile the macro and save.

If that doesn't work or you really want to move all the modules out of the existing Excel file into a new file, the other thing I use is the Source Tools Addin. If you want this to always be available, save it to %APPDATA%\Microsoft\Excel\XLSTART\. SourceTools adds a toolbar to the VBE.

  1. Open the problem file in Excel and show the VBE.
  2. In the Project Explorer, select the project name of the problem file.
  3. Click the diskette icon on the SourceTools toolbar. (This will save all modules to a [filename].src folder. i.e. C:\Data\Test.xlsm will now have a C:\Data\Test.xlsm.src\ folder.)
  4. Create a new workbook and click the open folder icon on the SoruceTools toolbar.
  5. Select the source folder just created.
  6. You will need to manually copy over any code in ThisWorkbook and any Sheet modules.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.