跪求高手大俠指點,我用vba在我公司一款軟體商寫代碼,需要呼叫dll封裝起來但是開放方法和物件的動態鏈接,我從參考中勾選了相關選項,在寫代碼將定義的物件實體化時也都有智能提示,但是運行時候報錯說自動化automation錯誤
代碼如下:
Public lest As New ACAMNESTLib.Nesting
Public Sub test()
Dim nest As Nestlist
Set nest = lest.NewNestList("mynest")
End Sub
請高手指點下,感激不盡,謝謝!

uj5u.com熱心網友回復:
看看這樣行不行?Public lest As ACAMNESTLib.Nesting
Public Sub test()
Dim nest As Nestlist
set lest=new ACAMNESTLib.Nesting
Set nest = lest.NewNestList("mynest")
End Sub
uj5u.com熱心網友回復:
我試過了,還是有相同的提示,因為這個dll檔案是呼叫軟體外部的,我看軟體的說明有些說的是要執行一些初始化陳述句 要放在什么類模塊中運行,但是我測驗是編譯錯誤,還是不行 原文如下:Interfaces
In 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:
method
CreateEventHandler
Use n.CreateEventHandler instead of New ACAMNESTLib.NestEvents
Dim WithEvents OrderEvent As ACAMNESTLib.NestEvents
Public Sub Init(n As Nesting)
'Set OrderEvent = New ACAMNESTLib.NestEvents
Set OrderEvent = n.CreateEventHandler
n.RegisterEventHandler OrderEvent
method
CreateExtensionHandler
Use n.CreateExtensionHandler instead of New ACAMNESTLib.NestingExtension
Dim WithEvents OrderExt As ACAMNESTLib.NestingExtension
Public Sub Init(n As Nesting, name As String)
'Set OrderExt = New ACAMNESTLib.NestingExtension
Set OrderExt = n.CreateExtensionHandler
n.RegisterExtensionHandler OrderExt
煩請高手指點
uj5u.com熱心網友回復:
有需要可以找我QQ上1085992075轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/128897.html
標籤:VBA
下一篇:求vb制作音樂播放器
