Problem with Class Interop and Interface

licensed123

New member
Joined
Apr 27, 2012
Messages
1
Programming Experience
1-3
Hi everyone,

I am just a newbie in this forum.

Before I am 100% of VBA programer. Now I step futher by using VB. NET to build ExcelAddin.

I managed to build a "library" base on VBA Code with multi level of class function.

Level1.jpgLevel2.jpg

However, when I move to VB. NET, I face a problem that I cannot expose a declare class data type (Class 1\Class 2\Class 3) as show above. Here my code and result:

Result.jpg

How can I show MySub in Intellisense and access through Report class if I change Public => Friend?

Many thanks in advance....
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop

Public Interface ReportInterface
Function FlashReport(ByVal Table As Excel.Range, ByVal Source As String, ByVal Query As String)
Function QuickReport(ByVal Table As Excel.Range, ByVal Source As String, ByVal Query As String)
Dim MySub As New SubReport 'ERROR must be function, sub
End Interface

Public Interface SubReportInterface
Function GetTitle() As String
End Interface

<ClassInterface(ClassInterfaceType.None)> _
Public Class Report : Implements ReportInterface

Public MySub As New SubReport 'not show in vba

Public Function FlashReport(Table As Microsoft.Office.Interop.Excel.Range, Source As String, Query As String) Implements ReportInterface.FlashReport
MsgBox("Here flash report")
FlashReport = vbNull
End Function

Public Function QuickReport(Table As Microsoft.Office.Interop.Excel.Range, Source As String, Query As String) Implements ReportInterface.QuickReport
MsgBox("Here quick report")
QuickReport = vbNull
End Function

End Class

Public Class SubReport : Implements SubReportInterface
Public Function GetTitle() As String Implements SubReportInterface.GetTitle
GetTitle = "Report title"
End Function
End Class
 
Back
Top