跪求高手大侠指点,我用vba在我公司一款软件商写代码,需要调用dll封装起来但是开放方法和对象的动态链接,我从引用中勾选了相关选项,在写代码将定义的对象实例化时也都有智能提示,但是运行时候报错说自动化automation错误
代码如下:
Public lest As New ACAMNESTLib.Nesting
Public Sub test()
Dim nest As Nestlist
Set nest = lest.NewNestList("mynest")
End Sub请高手指点下,感激不尽,谢谢!

解决方案 »

  1.   

    看看这样行不行?Public lest As ACAMNESTLib.Nesting
    Public Sub test()
    Dim nest As Nestlist
    set lest=new ACAMNESTLib.Nesting
    Set nest = lest.NewNestList("mynest")
    End Sub
      

  2.   

    我试过了,还是有相同的提示,因为这个dll文件是调用软件外部的,我看软件的说明有些说的是要执行一些初始化语句 要放在什么类模块中运行,但是我测试是编译错误,还是不行  原文如下:
    InterfacesIn AlphaV7, properties were added to the Drawing object to get the interface for the Parametric, Solid and STL add-ins, as a safer alternative to using New or CreateObject or CoCreateInstance. In AlphaV7.5 these properties must be used, the old ways will not work. This ensures that the correct version of the add-in is used, rather than the most recently-registered one. Nesting Macros and Extensions For the same reason as in the above paragraph, AcamNest.dll has a new type library and new methods in the Nesting object: methodCreateEventHandler Use n.CreateEventHandler instead of New ACAMNESTLib.NestEvents Dim WithEvents OrderEvent As ACAMNESTLib.NestEventsPublic Sub Init(n As Nesting)'Set OrderEvent = New ACAMNESTLib.NestEvents    Set OrderEvent = n.CreateEventHandler    n.RegisterEventHandler OrderEvent     methodCreateExtensionHandlerUse n.CreateExtensionHandler instead of New ACAMNESTLib.NestingExtension Dim WithEvents OrderExt As ACAMNESTLib.NestingExtensionPublic Sub Init(n As Nesting, name As String)'Set OrderExt = New ACAMNESTLib.NestingExtension    Set OrderExt = n.CreateExtensionHandler    n.RegisterExtensionHandler OrderExt    
    烦请高手指点