Fix Runtime Error 7

Runtime errors may occur when one or more files or processes required to launch a particular program are missing, damaged or develop a problem.

Error #1: Runtime error 7 in VB application

When you try to run a Visual Basic application on a computer on which the version of Microsoft office is prior to Microsoft Office 97, you may receive the following error:

Error 7 â€“ Out of memory

You may find that there is no loss of memory and the system behavior is consistent. Also, you may be able to successfully execute the Visual Basic application if Microsoft Office 97 is installed on the target machine.

Cause of the Error

The above issue occurs with the FM20.dll file.Â  The FM20.dll file is to be used with VBA only and is not a redistributable component.

FM20.dll is recorded to cause various issues when used with Visual Basic and other developer products. Visual Studio products do not support or recommend the use of FM20.dll.

Resolution Method

To fix runtime error 7, remove FM20.dll from the project.

Alternatively, you may fix the error by deploying the Visual Basic Application to a system that has Microsoft Office 97 or later versions of Microsoft Office installed.Â 

Error #2: Runtime error 7 due to corrupt comctl32.ocx file

You may also receive runtime error 7 errors when there are problems with the copy of the comctl32.ocx file on your computer. If this is the case, perform the following steps to fix the runtime error 7.

Resolution Method

To resolve the error in this case, you need to complete the following tasks:

Task 1: Unregister Comctl32.ocx file.
Task 2: Delete Comctl32.ocx file.
Task 3: Download a new copy of Comctl32.ocx file.
Task 4: Register Comctl32.ocx file.

To unregister and delete the comctl32.ocx file, perform the following steps:

  1. Click Start and then click Run.
  2. In the Open box, type the following commands and press Enter.
    regsvr32 -u comctl32.OCX
  3. If you receive an error message stating â€œDLL is not registeredâ€, press OK.
  4. Click Start and then click Search.
  5. Next, click All files and folders option.
  6. Type, comctl32.ocx in the All or part of the file name box and select Local Hard Drives from the Look in drop-down list.
  7. Click the Search button.
    The search results will appear in the right-pane.
  8. Note the folder in which comctl32.ocx file is located and then right-click the comctl32.ocx file and click Delete.

After you have unregistered and removed the comctl32.ocx file from your computer, download a fresh copy of the file from a reliable online File Directory and save the file in its default location.

Next, perform the following steps to register comctl32.ocx:

  1. Click Start and then click Run.
  2. Next, in the Open box type the following command and press Enter to register the file:

    regsvr32 comctl32.ocx