I want to do this: "If there's a module X containing a function Y then call it, otherwise don't."
I'm aware that I can use CallByName(Object, MethodName, ...)
to call a method or property of an object instance.
Is it possible to call a global sub/function which is not bound to an object?
//Module1
Public Sub DoSomething
End Sub
//Module2
Public Sub TriggerDoSomething
On Error Resume Next
CallByName2 "Module1", "DoSomething", ...
End Sub
I know, it would be better to refactor my code to wrap DoSomething
into a class, but currently this is not possible as it would break the code of my coworkers in a way that could not be fixed in a few hours.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…