定义一个事件处理类,类名为 clsBill
    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


 

相关文章:

  • 2021-08-15
  • 2022-12-23
  • 2022-02-02
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-12
  • 2021-06-25
  • 2021-12-24
  • 2021-06-08
  • 2021-06-23
  • 2021-08-29
  • 2021-11-15
相关资源
相似解决方案