필터 지우기
필터 지우기

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 CenterFile Exchange에서 Excel Integration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by