Why do I get the error: "User-Defined type not defined" from Microsoft Excel when I run my Visual Basic Macro?

3 views (last 30 days)
I have written a Visual Basic subroutine in to call my dll that was generated using MATLAB Excel Builder. I am trying to use MWFlags as in the XLMulti example in the documentation, but when I try running the program, the line where I dimension the variable give me the error:
User-Defined type not defined
What is going on?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Sep 2012
MWFlags is part of the MATLAB Excel Buildler Utility Library Classes.
In order to use these utilities you need to add a reference to the library inside of the MS Excel Visual Basic editor.
From Documentation:
*****************************************
The MWComUtil library includes seven classes (see Utility Library Classes) and three enumerated types (see Enumerations). Before using these types, you must make explicit references to the MWComUtil type libraries in the Visual Basic IDE. To do this select Tools->References... from the main menu of the Visual Basic editor. The References dialog box appears with a scrollable list of available type libraries. From this list select MWComUtil 1.0 Type Library and click OK.
*****************************************

More Answers (0)

Categories

Find more on Excel Add-Ins in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!