在VBA中实现接口的事件

时间:2019-02-27 13:19:01

标签: vba interface mvp

我有一个接口IView:

 Option Explicit

Public Event OnClientSelected()

Public Property Get ClientNames() As Variant
End Property
(...)

但是我无法以我的用户表单实施该事件。可以实现属性和sub,但不能实现事件。

是否可以通过事件来实现接口?

1 个答案:

答案 0 :(得分:-1)

您是否与事件一起使用?

我已经完成以下操作,并向您的班级添加了SELECT player_id as playerID, SUM(scores) as scores FROM `player_games` WHERE game_played >= DATE(NOW()) - INTERVAL 7 DAY GROUP BY player_id ORDER BY scores DESC 函数

test

函数已添加到类

Private WithEvents iface As clsIface

Private Sub UserForm_Initialize()
    Set iface = New clsIface
End Sub

Private Sub iface_OnClientSelected()
    '   Event subscription
End Sub

Private Sub UserForm_Click()
    iface.test
End Sub