# VBA auto login with Chrome



## Enzo_Matrix (Sep 18, 2018)

I found and modified a code that will let me automatically log into the site I want but I can't figure out how to change from IE to Chrome.

please help

```
Sub wisdomone()

Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Dim Myhtml_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear


MyURL = "www.website.com"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True


Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document
HTMLDoc.all.txtUSername.Value = "username"
HTMLDoc.all.txtPassword.Value = "password"
HTMLDoc.all.txtClient.Value = "clientID"


For Each Myhtml_Element In HTMLDoc.getElementsByTagName("Input")
    If Myhtml_Element.Type = "Submit" Then Myhtml_Element.Click: Exit For
        Next
Err_Clear:
    If Err <> 0 Then
    Err.Clear
    Resume Next
End If


End Sub
```


----------

