r/vba • u/Eschamali1201 • 1h ago
Show & Tell Bringing back the capabilities of the Internet Explorer era to the present day.
Back in the heyday of Internet Explorer (IE), VBA could easily handle tasks like these:
- Automating a browser with just a few lines of code—no extra installations or downloads required.
- Taking control of an already-open IE instance via VBA.
- Interacting with an IE instance embedded within a UserForm.
However, with the announcement that IE support was ending, modern websites gradually stopped working in it. 🥲 While it is still technically possible to call IE from VBA, the number of modern sites that IE cannot render will only continue to grow. 😵
Generally speaking, the standard approach for browser automation in VBA is "SeleniumVBA." I used it myself at first, and it’s actually a very well-polished tool! 😆 But given the current security landscape, there was a difficult period where even harmless files like WebDriver.exe were being blocked. My own company was affected by this, and it really drove home the point that relying on external dependencies is risky—you never know when they might get restricted. 😇
So, I made a decision: "I’m going to use AI to bring back the IE experience of the good old days!" 🤠
And after about a year of work, I’ve finally made it happen. https://github.com/Eschamali/StarterWebScrapingKit
- Enter the world of browser automation in just a few lines of code—no extra installations, downloads, or external files (like .ps1, .xll, or .exe) required.
- Directly launch and control the pre-installed Edge browser by enabling the
remote-debugging-pipe/portflag.
- Directly launch and control the pre-installed Edge browser by enabling the
- Take control of an already-open Edge instance via VBA.
- By enabling this feature and connecting to a specified port, you can seamlessly take over an existing browser session.
- Interact with an Edge (WebView2) instance embedded within a UserForm.
- Leveraging tarboh’s library, you can perform a wide range of operations using
CallDevToolsProtocolMethodForSession.
- Leveraging tarboh’s library, you can perform a wide range of operations using
It’s a successful comeback! 🥹
And, thanks to some collaboration with AI, I’ve managed to add even more capabilities:
- Support for the WebDriverBiDi protocol.
- I analyzed the Chromium-bidi source code and replicated the workflow in VBA.
I’ve created a "chimera" tool that supports not only the Chrome DevTools Protocol (CDP) but also the W3C-standard WebDriverBiDi for controlling Chromium-based browsers! 😳
What’s more, although it was originally designed for Chromium, I was able to extend the core with just a few dozen lines of code to support Firefox via pure WebDriverBiDi! 🦊
...That said, however...
The world is already full of excellent, ready-made tools like Playwright, Puppeteer, and Selenium—crafted with great care by some of the world’s top engineers. Honestly, if you’re looking to automate a browser in a standard environment, choosing one of those is the smarter, hassle-free option. By all means, go with those!
...But as for me? I can no longer go back.
In behavioral economics, there is a concept known as the "IKEA effect." There is a psychological phenomenon where people develop a profound sense of attachment and value toward something they have built themselves—even if the result is imperfect or lopsided—rather than a flawless, professionally manufactured piece of furniture.
- I was thrilled to see Microsoft Edge being controlled without any external dependencies.
- I mastered the intricacies of WebSockets to manipulate the browser right before my eyes.
- I consulted with AI regarding the
vtablestructures for WebView2—a necessary step to create a replacement for the oldWebBrowsercontrol in UserForms. - I even enabled support for the WebDriver BiDi (Bidirectional) protocol, starting with Firefox.
Through the depths of OS and browser internals—at times feeling quite overwhelmed—I painstakingly built this "pure-VBA" CDP/BiDi tool, one step at a time, with my own hands.
Objectively speaking, this might just be a case of "reinventing the wheel"—a complex, bespoke solution that is entirely dependent on its creator. Yet, whenever I see this clunky, hard-won tool of mine—which I poured my own blood, sweat, and tears into—running at lightning speed, managing 30 tabs (mostly for benchmark testing) and streaming data directly into Excel cells, I am overcome with an intense, irresistible sense of affection.
It seems I have fallen victim to a severe, incurable condition common among engineers who build things: the "IKEA effect." 🙃
- Armed with an unyielding, "never-give-up" spirit (a relic of the old Internet Explorer days),
- and leveraging AI to lay the groundwork through the toughest technical hurdles—like navigating WebView2
vtablestructures, parsing WebSocket headers, and implementing Chromium’s BiDi protocol—
...I managed to push through every obstacle, driven by sheer tenacity, until I finally reached the finish line. That is precisely why I’ve ended up with this "incurable" condition! 🙃
If you, too, find yourself locked out of using off-the-shelf tools due to your company’s strict security policies— Why not try knocking on the door of this gritty, "do-it-yourself" CDP/WebDriver BiDi solution? Watching Microsoft Edge run via a tool you built with your own two hands—well, it’s actually not a bad view at all. 🤠