1

Excel.Application.Run and VBA.Interaction.CallByName both seem to do similar things; namely calling a method using a string name. As I understand it, this functionality is enabled because VBA is an automation language and uses IDispatch for a lot of its objects and internal working.

What has this got to do with Excel then (or indeed PowerPoint.Application.Run)? Why is calling members of standard modules vs class modules so different?

Greedo
  • 4,967
  • 2
  • 30
  • 78
  • Very similar, but don't quite do the same thing. Application.Run() does more, it can also find and execute macros, lookup a formula from a Range object and execute XLL functions. – Hans Passant Oct 10 '20 at 15:18
  • @HansPassant Okay didn't know, but I guess what I'm really interested in is the calling from a standard module, why is this not built into VBA like calling from a class module is? – Greedo Oct 10 '20 at 15:33
  • The other stuff on formulae and ranges could be implemented separately by the host application, but calling methods of standard modules feels to me to be host-agnostic, so I'm wondering; is it/why is it not? – Greedo Oct 10 '20 at 15:33
  • VBA is heavily COM-centric at its core. Which does not have anything resembling a module (beyond the quirky appobject), its interface-based programming paradigm requires objects. – Hans Passant Oct 10 '20 at 16:09

0 Answers0