C
ct60
Hello again -
I am using Excel 2002 SP3 and am working on a project involving collecting
data from 7-8 different sources with various col formats, etc. It would be
neat if I could use an interface to define some functions to do this task.
Each object would implement the same functions in a slightly different way.
So as a simplified example - I have an interface in a class module called
"iData" defined as the following:
class iData
Public Function foo(whichWS As Worksheet) As Variant
End Function
Public Sub boo(ws1 As Worksheet, ws2 As Worksheet)
End Sub
Then I have another class module called "clsDB_Data" defined as follows:
clsDB_Data
Implements iData
Public Function foo(whichWS As Worksheet) As Variant
Dim v As Variant
foo = v
End Function
Public Sub boo(ws1 As Worksheet, ws2 As Worksheet)
MsgBox "Hello World!", vbExclamation
End Sub
This looks right to me but when I compile I get the puzzling error message:
Object Module needs to implement 'foo' for interface 'iData'
This message points to the clsDb_Data module.
I'm confused!!
Can anyone explain what is not right about what I am doing? Seems to me
that I am inplementing foo in my derived class module.
Any insight would be greatly appreciated.
Thanks in advance,
Chris (ct60)
I am using Excel 2002 SP3 and am working on a project involving collecting
data from 7-8 different sources with various col formats, etc. It would be
neat if I could use an interface to define some functions to do this task.
Each object would implement the same functions in a slightly different way.
So as a simplified example - I have an interface in a class module called
"iData" defined as the following:
class iData
Public Function foo(whichWS As Worksheet) As Variant
End Function
Public Sub boo(ws1 As Worksheet, ws2 As Worksheet)
End Sub
Then I have another class module called "clsDB_Data" defined as follows:
clsDB_Data
Implements iData
Public Function foo(whichWS As Worksheet) As Variant
Dim v As Variant
foo = v
End Function
Public Sub boo(ws1 As Worksheet, ws2 As Worksheet)
MsgBox "Hello World!", vbExclamation
End Sub
This looks right to me but when I compile I get the puzzling error message:
Object Module needs to implement 'foo' for interface 'iData'
This message points to the clsDb_Data module.
I'm confused!!
Can anyone explain what is not right about what I am doing? Seems to me
that I am inplementing foo in my derived class module.
Any insight would be greatly appreciated.
Thanks in advance,
Chris (ct60)