Assume I have a .Net library with a class(TestClass) with a function \'Add\'. I am accessing this in Excel by writing a VBA addin. I want to know the difference between the foll
You need to replace the = with the As keyword for the Dim statement in your code snippet. This works (assuming that the class is registered properly with COM):
Sub AccessExternalUdf()
Dim obj As New MyNamespace.MyClass
result1 = obj.MyMethod
result2 = Run("MyMethod")
End Sub
The difference (as stated above by @Hans) is early versus late (Run) binding.