9
votes

Google searches are leading me down a bunch of dead ends with this one.
I am developing an Excel add-in in VBA, and part of it involves the use of the WebBrowser control to display a (known) webpage inside a form and access its DOM components.

Unfortunately, this leaves me at the whim of the user's version of Internet Explorer.
For our actual webpages, we can use Chrome Frame support to allow IE users to see the page in the way we intend without worrying about their browser version, but the WebBrowser control does not see the browser plugins.

I have taken a look at WebKit.NET and GeckoFX. They sort of work, but unless I am completely missing something, they don't seem to have Javascript or CSS engines in them at all. Or (in the case of GeckoFX), they are using old engines. That makes them useless.

Is there any ActiveX control that I can embed in a VBA form which works like the WebBrowser control (with a similar-if-not-identical API), uses a different rendering engine that keeps up with the latest version of Mozilla/Chrome/Opera, and still supports Javascript and CSS correctly?

Thank you!

(Some edits based on the comments)

EDITED AGAIN: I found out from one answer below that I was looking at an outdated version of GeckoFX, but the newest version looks promising. But now I have a new related question: How do I include GeckoFX in VBA? Windows does not allow me to register it as a COM object. Do I have to build it myself from source somehow? Or what?

3
GeckoFX seems to support both CSS and JavaScript. Why do you think it doesn't? - arx
When I tried pointing it at my test page (which used javascript and jqueryUI), I saw an unadorned ugly CSS-less page. Like I said, maybe I did something wrong. - Josh
Oh right, the other thing, the GeckoFX documentation says it works best with Firefox 3.5 engine; I really need something that works with the latest-and-greatest (Firefox 7-ish, or Chrome, or even Opera) - Josh
Is it such a problem to rely on IE? IE has a lot of compatibility settings to ensure a common behavior across versions (from 7 to 9 mostly as 6 is almost dead). Cf msdn.microsoft.com/en-us/ie/cc405106 - Simon Mourier
Most of the target users of this add-in are, unfortunately, on XP with IE6; we can "strongly suggest" that they upgrade to 8 (but not 9, due to OS restrictions), but if I use the standard WebBrowser, I pretty much have to make sure it works with 6. - Josh

3 Answers

5
votes

Gecokfx supports Firefox up to 33.0

https://bitbucket.org/geckofx/geckofx/wiki/Version_lists

It supports both Javascript and CSS.

0
votes

If you want it to work in elderly VBA you need a browser in an ActiveX wrapper.

The Mozilla ActiveX Control would fit the bill, but that seems to be dead. (It lived on in Mozilla Prism, now Chromeless, but that doesn't have a binary download. And you can apparently build it yourself from the XULRunner source, but that's probably not straightforward.)

It might not be too hard to build GeckoFX as an ActiveX control.

-1
votes

If you use GeckoFX or Chrome Frame you will be at the mercy of the user's Firefox or Chrome version. No way to solve this problem other than specifying a baseline version for your users.

If you cannot do this I suggest you work around the differences in your VBA code.

In other words: Use the IE WebBrowser control, because it is guaranteed to be installed in some version or another, and either specify a minimum version of IE (I suggest IE6 which everyone should have) and cope with the differences by detecting the version and working around the differences from VBA.