Reputation: 81
Is there a keyword for the with-block variable? If that keyword would be for example This
, the following code would work:
With New myType
.DoSomething
DoSomethingElse "abc", This, 123
End With
Upvotes: 0
Views: 45
Reputation: 13386
you could add the following Function
to your MyType
class
Public Function This() As MyType
Set This = Me
End Function
so that your main code could exploit it as follows:
With New MyType
.DoSomething
DoSomethingElse "abc", .This, 123
End With
Upvotes: 3
Reputation: 374
I'm afraid such a keyword doesn't exist. In Visual Basic I have written an extension method .Myself
for this. In VBA I don't know any solution. Of course you can use a local variable.
Set a = New mytype
a.DoSomething
DoSomethingElse "abc", a, 123
Upvotes: 1