Matlab DLL错误:-2147467259适用于64位环境下的VBA

时间:2015-07-31 04:38:29

标签: matlab vba 64-bit excel-addins

我使用Matlab的deploytool在64位环境下制作了dll。 相同的功能和命令在32位环境中运行良好。

我的成就是什么?

vba代码

Dim MCLUtil As Object
Dim bModuleInitialized As Boolean
Dim xlmagicclass As Object

Private Sub InitModule()
    If Not bModuleInitialized Then
        On Error GoTo Handle_Error
        If MCLUtil Is Nothing Then
            Set MCLUtil = CreateObject("MWComUtil.MWUtil")
        End If
        Call MCLUtil.MWInitApplication(Application)
        bModuleInitialized = True
        Exit Sub
Handle_Error:
        bModuleInitialized = False
    End If
End Sub


Sub mymagic()
     Dim R1 As Range 'Input value
     Dim R2 As Range 'Output range

     On Error GoTo Handle_Error
     Call InitModule
     Set R1 = Range("A2")     'Specify where the input value is.
     Set R2 = Range("B2:E5")  'Specify that range for the output to use.
     If xlmagicclass Is Nothing Then
         Set xlmagicclass = CreateObject("xlmagic.xlmagicclass.1_0")   
     End If
     Call xlmagicclass.mymagic(1, R2, R1)
     Exit Sub
Handle_Error:
     MsgBox ("Error: " & Format(Err.Number) & " Source: " & Err.Source & "     Message: " & Err.Description)
End Sub

matlab代码

function y = mymagic(x)
y = magic(x)
The error message

    Error: -2147467259 Source: xlmagic.xlmagicclass.1_0 Message:

1 个答案:

答案 0 :(得分:0)

已经分两步解决了。

  1. 只需安装" MyAppInstaller_web" for_redistribution文件夹中的文件。

  2. 并在for_redistribution_files_only文件夹中运行_install批处理文件。