From Excel we can create can load an explorer instance (inside an userform for example). From there, one can reach any site, and more interesting, if there is a login filter, username and password can be fetch and go forward.
But there can be some caveats, for example GMail site that has a two stages login, so it has to be evaluated twice where to fill data between complete login.
Place a Microsoft Internet Controls (also Microsoft WebBrowser) -refered to ieframe.dll-, as is not in the default controls palette, you have to search for it in “Additional Controls”. For a site like GMail it Will complain a lot, as it old browser technology, but it’ll go to the end.
For the second stage, the function WebBrowser1_DocumentComplete, will analyse that first stage has been succesfully surpassed.
Add two textboxes and rename then to txtUserName and txtPassword, add a button named cmdAction. For instance, you can add a textbox and name it txtURL and finally a button cmdGo to navigate to desired site.
Paste the following code in the userform, and browse!
Private bWebChange As Boolean
'Private Sub txtURL_Change()
Private Sub txtURL_Enter()
Private Sub UserForm_Initialize()
'It's not the same to go from different webbrowser, site can change for each browser...
'Is is a multipage site?
.txtUsername.Text = ""
.txtPassword.Text = ""
Private Sub cmdGo_Click()
If .txtURL.Text Like "http*//*" Then
.txtURL.Text = .txtURL.Text
ElseIf .txtURL.Text Like "www*" Then
.txtURL.Text = "http://" & .txtURL.Text
'count dot chars
.txtURL.Text = "http://www." & .txtURL.Text
Private Sub cmdAction_Click()
' Always get "name" property
If Not bWebChange Then Exit Sub 'Wait for completion
' Go to site and search <input for input box... get "name" property
' Go to site and search "*button*" for buttons ...
.Document.all("Email").Value = Me.txtUsername.Text
bWebChange = False
If bWebChange Then
'Wait until complete... go to next page
.Document.all("Passwd").Value = Me.txtPassword.Text
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If pDisp Is WebBrowser1.Application Then
bWebChange = True
' Now you can poke around the Document Object