Eisasuarez
Well-known Member
- Joined
- Mar 23, 2012
- Messages
- 653
Thank You
Option Explicit
Implements ITest
Option Explicit
Option Explicit
Sub main()
Dim clsTest As cTest
Set clsTest = New cTest
Debug.Print TypeOf clsTest Is cTest
Debug.Print TypeOf clsTest Is ITest
Debug.Print TypeName(clsTest)
End Sub
I mean it returns a word describing the variable type. For example, in the below code TypeName returns the string "Range".what do you mean by string result
Sub foo()
Dim r As Range
Set r = Range("A1")
MsgBox TypeName(r)
End Sub
Each one has situations where it is better to use than the other (a number of which I have already listed), but if you have a situation where you could equally use either then it would be better to use TypeOf because it is faster. There are also some differences in relation to use against arrays and user defined types, which I didn't list in my first reply.So which one do you recommend to use?
Sub foo()
End Sub
Sub foo()
End Sub
Implements I1
Implements I2
Private Sub I1_foo()
End Sub
Private Sub I2_foo()
End Sub
Sub main()
Dim clsTest As cTest
Set clsTest = New cTest
Debug.Print TypeOf clsTest Is cTest 'true
Debug.Print TypeOf clsTest Is I1 'true
Debug.Print TypeOf clsTest Is I2 'true
End Sub
Yes - same name. Convention is to prefix the class name with I if just using it as an interfaceHowdy, Rory.Okay ... how does the interface name get bound? Can you show a simple example?EDIT: Interface name == class name?