MATLAB: How to use components created with the MATLAB Excel Builder 1.1 (R13) and the MATLAB Builder for Excel 1.2 (R14) on the same machine

comdifferentMATLAB Builder EXversionversions

I am using a machine that runs Excel applications that use components created with the MATLAB Excel Builder 1.1 (R13) and the MATLAB Builder for Excel 1.2 (R14). I am only able to successfully use the application that uses the component that I registered most recently.

Best Answer

To use components created with the MATLAB Excel Builder 1.1 (R13) and the MATLAB Builder for Excel 1.2 (R14) on the same machine, take the following steps:
1. Make sure that the proper directories are on the system path for both the R13 and R14 runtime libraries, as noted in documentation for these products. Furthermore, make sure that the R13 libraries appear before the R14 libraries on the system path.
2. In all of the VBA projects that are in use, locate the following line of code that was generated by the MATLAB Builder for Excel:
Set MCLUtil = CreateObject("MWComUtil.MWUtil")
For projects associated with components created with the MATLAB Excel Builder 1.1 (R13), change this line to:
Set MCLUtil = CreateObject("MWComUtil.MWUtil1.0")
For projects associated with components created with the MATLAB Builder for Excel 1.2 (R14), change this line to:
Set MCLUtil = CreateObject("MWComUtil.MWUtil7.0")
Note that it possible only to run one version at a time in a given instance of Excel. For example, if two workbooks are open in a single Excel process, they could both use R13 components, or they can both use R14 components, but not a mixture of the two. However, it is possible to start multiple Excel processes via Start->Microsoft Office->Excel and open the R13 workbook in one process and the R14 workbook in another process simultaneously.