Monkey Patching in VBA

(ecp-solutions.github.io)

43 points | by n013 5 days ago ago

7 comments

  • asveikau an hour ago ago

    I thought that the VBscript engine, accessible from cscript.exe, also has a builtin JavaScript frontend. The idea being that both of these are a scripting language that can interact with COM objects. No idea if the various embeddings of VBScript such as excel or ASP can use js out of the box though.

    • layer8 7 minutes ago ago

      VBScript is deprecated since 2023 and in the process of being removed: https://techcommunity.microsoft.com/blog/windows-itpro-blog/...

      You also cannot run VBScript from VB or VBA, other than invoking it as a separate process. VBA is not an "embedding of VBScript". VB/VBA is compiled to an intermediate representation called P-code, they aren't scripts in the sense of being executed from a textual representation.

    • 22c 4 minutes ago ago

      I believe you're thinking of JScript, they're not quite the same thing.

  • n013 4 days ago ago
  • EvanAnderson 5 hours ago ago

    If it's not immediately clear toyou what this thing (ASF) (like it wasn't to me) this quote from the Github README is useful:

    > JavaScript-like scripting language implemented entirely in VBA. Zero COM dependencies. Native Office object model integration with runtime monkey patching capabilities.

    That's bananas!

    The specific feature being referred-to by the current title ("Monkey Patching in VBA") is functionality to allow you to override or add additional methods to the stock Office COM objects in this ASF scripting language. That's wild.

    The extensibility of the Office object model using VBA is powerful and horrifying.

  • RyJones 4 hours ago ago

    VBA is an interesting language. The builtins are huge - C++ may never have a loan amortization primitive, but VBA sure did/does

  • _boffin_ 5 hours ago ago

    Okay… this is novel to me and love it! Wish I knew about this 10 years ago.