Cannot Compile Excel VBA Project

Cannot Compile Excel VBA Project

by Addison Philip in Computers / Data Recovery    (submitted 2009-08-17)

Microsoft Excel allows you to extend its functionality beyond its defaults by the use of programming language Microsoft Visual Basic. The VBA code in this environment is written, changed, compiled and viewed in the VBA editor. The VBA editor organizes and shows all the VBA modules in VBA projects. Actually, each time when you create a new workbook, a VBA project gets automatically created and attached with it.  Occasionally, you cannot compile the VBA code.

At times, you find difficulties while compiling a VBA project associated with a workbook. The odds are that the workbook is corrupted. Thus, to restore the corrupted workbook, you will need to use your current backup. Alternatively, you can also opt for scanning the damaged workbook by using an Excel Recovery application .

For an instance, after you edit an existing VBA project, when you try to compile it, you get the similar error :

“AppName: excel.exe AppVer: 9.0.0.2719 ModName: vbe6.dll

ModVer: 6.3.91.8 Offset: 00083676″

This behavior occurs irrespective of changes made to the project.

Cause

There can be several causes that might prevent a VBA project from being compiled. Some of them are listed below:

  • Bugs in code
  • Code size limitation issues
  • Use of default names for macros
  • One or more modules are corrupted
  • Current workbook is corrupted

Solution

You need to try following suggestions to solve the issue described above:

  • Try running the code without compiling by using Debug modes in the VBA Editor. This will help you to detect the code bugs, if any
  • You should try deleting one or more functions.
  • If the error is from naming conventions issues for modules, you need to copy the code into modules and name them differently.
  • Try creating a new VBA project and copy the modules and functions one at a time. This will help you to detect the corrupted modules. Delete the corrected modules, if any.
  • You should attempt to import the code to a new workbook to compile it. If it gets compiled and runs successfully, the current workbook is corrupted. Use backup to restore the file.

If you lose data while no clean backup is available, scan the damaged workbook by using an Excel Repair tool. Excel file repair software can repair the damaged workbook by using powerful algorithms while providing graphically rich user interface. Stellar Phoenix Excel Recovery is a comprehensive tool to repair damaged Microsoft Excel files. It supports Excel repair for Excel 2010, 2007, 2003, 2002, and 2000. It can restore all file objects, such as hyperlinks, formulas, charts, pivot tables, macros etc. This non-destructive software is compatible with Windows 7, Vista, XP, 2003, 2000, and NT.

About the Author

Addison Philip works as a freelancer and researcher for  xls repair &  Excel file repair software. Use and distribution of this article is subject to our Publisher Guidelines whereby the original author’s information and copyright must be included.

Thanks for installing the Bottom of every post plugin by Corey Salzano. Contact me if you need custom WordPress plugins or website design.