¿Cómo implemento mi clase ClsInterface
, que tiene este código:La implementación de mi propia interfaz en VBA - Error: módulo de objeto necesita implementar 'x' para la interfaz 'y'
Public Function add(x As Integer, y As Integer) As Integer
End Function
en mi clase Class2
, que tiene este código:
Implements ClsInterface
Public Function add(x As Integer, y As Integer) As Integer
add = x + y
End Function
Mi código de prueba es
Public Sub test()
Dim obj As New Class2
MsgBox obj.add(5, 2)
End Sub
esto siempre viene con el siguiente error:
Microsoft Visual Basic
Compile error:Object module needs to implement 'add' for interface 'ClsInterface'
OK/Help
pero no hay ayuda con la ayuda de Microsoft (cuando presiono el botón Ayuda).
alguna idea?
Aquí está [Cómo utilizar las herramientas en Excel VBA] (http://stackoverflow.com/questions/19373081/ how-to-use-the-implements-in-excel-vba/19379641 # 19379641) –