In the past I have used the Microsoft WebBrowser control in many VB6 and Excel VBA forms. I need to do it again, but I can't figure out how to do it.
I tried opening an old VB6 project and I got this error message:
Line 17: Class SHDocVwCtl.WebBrowser of control WebBrowser was not a loaded control class.
I tried adding a reference to Microsoft Web Browser
to a new VBA project, but it doesn't exist.
I tried adding a reference to msi.dll
as suggested here, but didn't help.
I tried from the Developer ribbon - Insert - More Controls - Microsoft Web Browser, it does exist, but it says Cannot insert object
.
I tried using the Shell.Explorer.2
object as described here, but I get an error:
Sheet1.OLEObjects.Add ClassType:="Shell.Explorer.2", Left:=147, Top:=60.75, Width:=400, Height:=400
Run-time error '1004':
Cannot insert object.
The only way that worked was opening an IE window, but I need the browser to be embedded in a form because I need to add a few custom buttons:
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True