Excel crashes in VBE7.DLL running or enabling macro


When attempting to run VBA code in Excel, the following error may be thrown:

"File not found". When you click OK, the Visual Basic Editor (VBE) shows up and you may have to break out of the code. Or, Excel may just crash with the following error signature:

Faulting application name: EXCEL.EXE, version: 14.0.6117.5003, time stamp: 0x4f622ef8
Faulting module name: VBE7.DLL, version: 7.0.16.25, time stamp: 0x4e49ae34

The version of Excel may vary as may the version of VBE.DLL

To get past this error there are a couple of things you can do.

Method1 - Recompile the Project

1. Open the workbook in Excel. Normally Excel will disable macros in a worksheet until you click a button to enable the macros. Do not enable the macros just yet.
2. Open the VBA editor. You can hit ALT+F11 or on the ribbon click Developer > Visual Basic
3.  In the VBA editor double click your module or first module that contains your project. Add a commented line of code such as:

‘ This is a comment

Then click on the Debug menu at the top and click Compile VBA Project.

Repeat this step for each module in your workbook and then save the workbook.

4. Close the workbook and re-open it and enable the macros and test it. 

Method 2 - Disable Compile on Demand

In the VBE Editor in Excel, click on Tools > Options > General tab and click to uncheck “Compile on Demand”.

Alternatively you can set the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\VBA\7.0\Common
Type:  DWORD
Name:  CompileOnDemand
Value:  0

Comments (14)

  1. kishhr says:

    This kind of stuffs are more to come i request microsoft to provide seperate division on bug and error handling stuffs

  2. Ross says:

    Finally, a solution to the dreaded VBE7.dll Excel has stopped working crash

  3. Mirek says:

    Thank you, it works great!

  4. Zabalero says:

    For me this is not working.
    If I compile, Excel crashes.
    If I disable CompileOnDemand Excel it crashes when opening the file.
    The best part is that this started to happen after updating to Office 2013 Service Pack 1.
    Thanks Microsoft, as usual, for complicating my working day.

  5. PatBriPerso says:

    I have the same issue with Office 2013 under Windows 8. As Zabalero the 2 solutions above does not solved the issue for me.
    I have also Office 2013 under Windows 7 and I do not have the issue.

  6. PatBriPerso says:

    More information: I use Microsoft Office 365 Family Premium
    – under my Windows 8 PC Excel version is Excel 2013 (15.0.4569.1504) MSO (15.0.4569.1506) 32 bits
    – under my Windows 7 PC Excel version is Excel 2013 (15.0.4551.1510) MSO (15.0.4551.1508) 32 bits

  7. EB says:

    this solution don’t work for me.
    There is a big buzz about it on the internet.

    I post here the ONLY solution that I found that helps.
    reffer to the controls like this : YourUserForm.Controls("YourControlName")……..

    and NOT directly like this : Me.CotrolName , OR like this YourUserForm.ControlName

  8. Hannes says:

    This is still an issue on the 2015/07/21 version of VBE7.DLL for Excel 2013 64-bit.
    Also as described on expert’s exchange, Microsoft has confirmed this as a known issue.
    http://www.experts-exchange.com/questions/28701687/Random-64-bit-Excel-2013-VBA-crashes-VBE7-dll-errors.html

    This is happening on multiple workbooks for myself and I am resorting to an attempt to script the re-save fix. (Compile on demand settings do not help)

  9. Hannes says:

    Method 2 does not work in my case (Excel 2013 64-bit with latest 2015/07 DLL’s as per KB3039734)
    Method 1 and a variant to trigger recompilation: Add+Delete a sheet, does work…. this allowed me to create a VBS as workaround while I log an incident… save below as a VBS in the same folder as the xlsm files:

    Resave “myfile.xlsm”

    Sub Resave(filename)
    Set objExcel = CreateObject(“Excel.Application”)

    currentDirectory = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))

    objExcel.Application.AutomationSecurity = 3
    objExcel.Application.enableevents = False
    objExcel.Application.Workbooks.open(currentDirectory + “\” + filename)
    objExcel.Application.Visible = True

    objExcel.Application.DisplayAlerts = False
    Set objSheet = objExcel.ActiveWorkbook.Sheets.Add
    objSheet.Delete
    objExcel.Application.DisplayAlerts = True

    objExcel.Application.enableevents = True
    objExcel.ActiveWorkbook.Save
    objExcel.ActiveWorkbook.Close

    objExcel.Application.Quit

    Set objExcel = Nothing
    End Sub

  10. Hannes says:

    Excel 2013 crash is fixed in 3rd May 2016 patch:

    https://support.microsoft.com/en-us/kb/3085486

    1. Hannes says:

      The crash in Excel 2013, fixed by KB3085486 has been re-introduced in the latest version of VBE7.DLL dated 2016/10/18.
      I had to manually roll back to the KB version – don’t have the patience to log this with MS again.

  11. Andres Aponte says:

    Mil gracias excelente infromacion…

  12. Andres says:

    Thanks a lot. Worked on a file with activex content for more than 5 hours, then it didn’t stop crashing until applying method 1.

  13. David Hoffer says:

    Method 1 just solved my issue using Office 365 and Excel 2016. Now if I can just solve a recurring “not enough resources” that seems to happen only when my auto job runs overnight.

Skip to main content