I\'ve developed a VB.NET library (partially developed on C# as well) that heavily depends on inheriting from an abstract generic base class, and I\'m trying to figure out th
As i mentioned in comment writing library (dll) for MS Office applications is bit... hard-coded. This dll must exposes methods and properties to be able to use it in COM automation. To be able to achieve that, you need to write interface(s):
Namespace VBtoVBA
Public Interface IMyDerivedClass
Property MyProperty As String
End Interface
End Namespace
then in DerivedClass
Public Class MyDerivedClass
Inherits MyBaseClass(Of String)
Implements IMyDerivedClass
Private _myProperty As String
Public Property MyProperty As String Implements IMyDerivedClass.MyProperty
Now, go to Project Properties
window
1) choose Application
tab - click on Assembly Information
button and in the next window select Make assembly COM visible
checkbox (apply setting using OK
button),
2) choose Compile
tab - select Register for COM interop
checkbox
3) Save project and Build dll
4) Now, go to VBA Code editor in Office application -> References
menu. In Reference window
add reference to yourDllName.tlb
Now, you can use your dll in Office application ;)
I tested code:
Option Explicit
Sub DoSomething()
Dim m As VBtoVBA.MyDerivedClass
Set m = New VBtoVBA.MyDerivedClass
m.MyProperty = "Something"
MsgBox m.MyProperty
End Sub
and it works as well ;)