Public Event BeforeSave()
Public Event AfterSave()
Public Sub save()
RaiseEvent BeforeSave
Debug.Print "save过程"
RaiseEvent AfterSave
End Sub
编译出来的dll为 project1.dll
插件处理类1 test1
Public WithEvents m_bill As project1.clsBill
Private Sub Class_Initialize()
Set m_bill = New clsBill
End Sub
Private Sub Class_Terminate()
Set m_bill = Nothing
End Sub
Private Sub m_bill_BeforeSave()
Debug.Print "引发了 BeforeSave 事件"
End Sub
编译出来的dll 为 addin1.dll ,该类名为 addin1.test1
在主窗体中,
Dim obj As Object
Dim component As String
Private Sub Command1_Click()
obj.m_bill.save
End Sub
Private Sub Form_Load()
component = "addin1.test1"
Set obj = CreateObject(component)
End Sub