フィルターのクリア

Problems to call matlab in vba code

9 ビュー (過去 30 日間)
wladi pat
wladi pat 2014 年 1 月 17 日
コメント済み: Eric 2014 年 1 月 24 日
Dear all,
I created a dll calling Matlab from vba code. Everything was working well until yesterday... (I do not know what I changed but I must have change something...). I now have an error in my vba code when I try to run the following line:
Private Sub InitModule()
If Not bModuleInitialized Then
modName = "MtlbRiskPremiaComputation_v2012b.MtlbRiskPremiaComputation2012b.1_0"
On Error GoTo Handle_Error
If MCLUtil Is Nothing Then
Set MCLUtil = CreateObject("MWComUtil.MWUtil8.0") %where I got the error message
End If
The error message I have: "Error in VBA project: Automation error ClassFactory cannot supply requested class"
It seems that excel is not able to communicate with Matlab anymore. Do you have any idea where it may come from ? (something related to the compiler ? to the startup file ?)
Thank you in advance for your precious help
  3 件のコメント
wladi pat
wladi pat 2014 年 1 月 20 日
Thank you Andrew, it is now working !
Eric
Eric 2014 年 1 月 24 日
This error seems isolated to the January 2014 update from Bloomberg. Rolling back to the December 2013 release of Bloomberg allows the code to work as expected. But unfortunately, Bloomberg will eventually self-update to the current release. Unfortunately, the OP's answer about re-registering the DLLs from the runtime and compiled DLL did not do the trick for me. Only a reinstall of the Dec 2013 Bloomberg worked.

サインインしてコメントする。

回答 (1 件)

Vignesh
Vignesh 2014 年 1 月 21 日
編集済み: Vignesh 2014 年 1 月 21 日
Please re-register the DLL's and use the Excel addin.
regsvr32 <matlabroot>runtime\win32\mwcommgr.dll
regsvr32 <matlabroot>runtime\win32\mwcomutil.dll
regsvr32 <project_dll_dir>\projectdll_1_0.dll
Here, matlabroot corresponds to the folder obtained by executing MATLABROOT in MATLAB command line.
This would re-register the DLLs and did not conflict after enabling the Bloomberg Excel Addin.

カテゴリ

Help Center および File ExchangeExcel Integration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by