Код: Выделить всё
Imports System.Reflection
<Assembly: AssemblyKeyFile("C:\PRG\VB\COM\MyClassLibrary\MyNETClass.snk")>
Public Interface ITestMessage
Function GetMessage() As String
End Interface
Public Class MyNETClass
Implements ITestMessage
Public Function GetMessage() As String Implements ITestMessage.GetMessage
Return "Test Message"
End Function
End ClassA reference to 'MyClassLibrary' could not be added.
The ActiveX type library 'C:\....\MyClassLibrary.tlb' was exported from a .Net assembly and cannot be added as a reference.
Add a reference to the .NET assembly instead.
При этом легко могу добавить (и использовать) reference на MyClassLibrary.dll. Когда же пытаюсь подключить этот же COM в VBA Excel (там тоже ссылка на 'C:\....\MyClassLibrary.tlb') то не работает код:
Код: Выделить всё
Sub test()
Dim obj As MyNETClass
Set obj = New MyNETClass
obj.GetMessage
End SubRun-time error'-2147024894(80070002)':
File or assembly name MyClassLibrary, or one of its dependencies, was not found.
Где искать ошибку?
Спасибо.