Problems to call matlab in vba code
8 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
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
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
This would re-register the DLLs and did not conflict after enabling the Bloomberg Excel Addin.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!