Main Content

Errors and Solutions

View errors you may encounter using MATLAB® Compiler™, probable causes for these errors, and suggested solutions.

Excel Add-Ins Errors and Suggested Solutions

Errors, Warnings, Cause and Suggested Solutions

MessageProbable CauseSuggested Solution

Excel® (64-bit) hangs when calling the add-in.

The MATLAB code contains a call to actxGetRunningServer.

Remove the call to actxGetRunningServer. The workflow is not supported for 64-bit Excel.

MBUILD.BAT: Error: The chosen compiler does not support building COM objects.

The chosen compiler does not support building COM objects.

Rerun mbuild -setup -client mbuild_com and choose a supported compiler.

Error in component_name.class_name:
Error getting data conversion flags.

Usually caused by mwcomutil.dll not being registered.

Open a DOS window, change folders to matlabroot\bin\win64 (matlabroot represents the location of MATLAB on your system), and run the command
mwregsvr mwcomutil.dll.

See Register Add-Ins and COM Components for full details.

Error in VBAProject: ActiveX component can't create object.
  • Project DLL is not registered.

  • An incompatible MATLAB DLL exists somewhere on the system path.

If the DLL is not registered, open a DOS window, change folders to <projectdir>\distrib (<projectdir> represents the location of your project files), and run the command:
mwregsvr <projectdll>.dll.

See Register Add-Ins and COM Components for full details.

Error in VBAProject: Automation error The specified module could not be found.

This usually occurs if MATLAB is not on the system path. This error message occurs if you have more than one version of MATLAB on your system path.

Anytime you have multiple versions of MATLAB, ensure that the newest version of MATLAB appears on your path first. You can verify that the newest version of MATLAB is on the path first by typing path at the DOS prompt. See the table Required Locations to Develop and Use Components.

LoadLibrary
("component_name.dll") failed - The specified module could not be found.

You may get this error message while registering the project DLL from the DOS prompt. This usually occurs if MATLAB is not on the system path.

See the table Required Locations to Develop and Use Components.

Cannot recompile the M file xxxx because it is already in the library libmmfile.mlib.

The name you have chosen for your MATLAB file duplicates the name of a MATLAB file already in the library of precompiled MATLAB files.

Rename the MATLAB file, choosing a name that does not duplicate the name of a MATLAB file already in the library of precompiled MATLAB files.

Arguments may only be defaulted at the end of an argument list.

You have modified the VB script generated for MATLAB Compiler and have not provided one or more arguments used in the modified script.

Provide a value for any argument that requires an explicit value. Arguments that accept defaults appear at the end of the argument list.

Unable to use accessibility screen-readers or assistive technologies, such as JAWS®, Required files JavaAccessBridge.dll and WindowsAccessBridge.dll no longer added automatically to your Windows® path.

Add the following DLLs to your Windows path:

JavaAccessBridge.dll
WindowsAccessBridge.dll

Error in class.method.versionThis is a generic message, but is sometimes seen when there are conflicts in architecture versions of MATLAB and Microsoft® Excel.See Deployment Target Architectures and Compatibility for detailed information.
Error:
Error IMWDispatchDriver "Method Load of object IMWDispatchDriver failed"

Different versions of the MATLAB Runtime and MATLAB results in the IMWDispatchDriver error.

Check for the current versions of MATLAB and the MATLAB Runtime. Verify the MATLAB version by typing the MATLAB path in DOS prompt. If the versions do not match update and install the new version of the MATLAB Runtime that matches the current MATLAB version.

Error in VBA project: Method xxx of object 'IClass1' failed

Multiple versions of MATLAB running on the system results in this error.

Register the mwcomutil.dll and mwcommgr.dll registry files. Open a DOS window, cd to matlabroot\bin\win64 (matlabroot represents the location of MATLAB on your system), and run the command
mwregsvr mwcomutil.dll
mwregsvr mwcommgr.dll

Warning: File not found. Excel primary interop assembly is not found.

Visual Studio® does not have Visual Studio Tools

Install Visual Studio Tools while installing Visual Studio to access all the files and package deployable archive with Excel Integration target.

An error occurred when sending commands to the program.

The Ignore other applications that use Dynamic Data Exchange (DDE) check box in Excel options is selected.

  1. Select File and then Options.

  2. Select Advanced, navigate to the General section, and ensure the Ignore other applications that use Dynamic Data Exchange (DDE) option is unchecked.

  3. Click OK.

Required Locations to Develop and Use Components

Component and Target Machine

ComponentDevelopment Machine Target Machine
MATLAB RuntimeMake sure that matlabroot\bin\win64 appears on your system path ahead of any other MATLAB installations.
(matlabroot is your root MATLAB folder.)
Verify that <MATLAB_RUNTIME_INSTALL_DIR>\<ver>\runtime\<arch> appears on your system path. For more information, see Set MATLAB Runtime Path for Deployment

Microsoft Excel Errors and Suggested Solutions

Error, Cause, and Solutions

MessageProbable CauseSuggested Solution
The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros.
Note: Wording may vary depending upon the version of Excel you are running.

The macro security for Excel is set to High.

Set Excel macro security to Medium on the Security Level tab by doing the following:

  • For Microsoft Office 2010 or later:

    1. Click File > Options > Trust Center > Trust Center Settings > Macro Settings.

    2. In Developer Macro Settings, select Trust access to the VBA project object model.

  • For Microsoft Office 2007:

    1. Click the 2007 Office button on the Microsoft Office ribbon.

    2. Click Excel Options > Trust Center > Trust Center Settings > Macro Settings.

    3. In Developer Macro Settings, select Trust access to the VBA project object model.

Function Wizard Problems

Problems, Cause, and Suggested Solutions

ProblemProbable CauseSuggested Solution

The Function Wizard Help does not appear.

The Function Wizard Help file (mlfunction.chm) is not in the same folder as the Function Wizard add-in (mlfunction.xla).

Copy the Help file (mlfunction.chm) into the same folder as the add-in.

The Function Wizard did not automatically import your .bas file, and you have to create your macro manually

The Function Wizard has malfunctioned with an unspecified error

  1. Open Excel

  2. Do one of the following:

    • For Microsoft Office 2007 or later, click Developer > Macros.

    • For Microsoft Office 2003, click Tools > Macros > Macro.

  3. From the Visual Basic® Editor, select File > Import and select the created VBA file from the <project_dir>\distrib folder.

Tip

You may need to enable the Developer menu item before performing this step.

For Office 365:

  1. Click File.

  2. Click Options and select Customize Ribbon.

  3. Under Customize the Ribbon:, select Main Tabs and check the Developer check box.

For Microsoft Office 2007 or 2010:

  1. Click the Office button on the Microsoft Office ribbon, or in Office 2010, click File to display the Office Backstage View.

  2. Click Excel Options.

  3. In the Top Options for Working With Excel area, select Show Developer tab in the Ribbon.

You get an error when trying to create a macro with the Function Wizard

The message Failed to start MATLAB appears instead of Starting MATLAB... when MATLAB is invoked by the Function Wizard.

This message may appear if you manually terminate the MATLAB session that is invoked from the Function Wizard. As a result, you can no longer use the wizard's MATLAB related features in your current Excel session.

Save your work and restart Microsoft Excel.

When I use CTRL + arrow keys to select ranges with the Function Wizard, once I select a function and begin to select the function inputs, keyboard navigation no longer works in excel.

This behavior results from a bug in Microsoft Excel.

If you must use arrow keys to select ranges, apply the following fix.
  1. Exit Excel, if it is running.

  2. Using the Run app, open regedit.

  3. Locate and then select the following registry key:

    HKEY_CURRENT_USER\software\microsoft\office\<version>\Excel\options

  4. On the Edit menu, click New, and then click DWORD value.

  5. Type QFE_Richmond as the new value, then press ENTER.

  6. Right-click the QFE_Richmond registry key, then click Modify.

  7. In the Value data box, type: 1

  8. Click OK, and then exit Registry Editor.