# Filling in website UserName & Password with VBA



## Big Lar (Feb 9, 2019)

I found this code (which I might find useful) to open Internet Explorer and fill in Username and password on the specified website.
It works until ie.Document.getElementById("uid").Value = "testID"​. ("Object required" error)
I'm at a loss as to the correct nomenclature to try it out.

Also, can this or something else be modified to work with Microsoft Edge or Google Chrome?


```
Sub test()
' open IE, navigate to the desired page and loop until fully loaded
    Set ie = CreateObject("InternetExplorer.Application")
    my_url = "app.groupworks.com/#/login"
 
    With ie
        .Visible = True
        .Navigate my_url
        .Top = 50
        .Left = 530
        .Height = 400
        .Width = 400
 
    Do Until Not ie.Busy And ie.readyState = 4
        DoEvents
    Loop
 
    End With
 
' Input the userid and password
  [COLOR=#008080]  ie.Document.getElementById("uid").Value = "testID"[/COLOR]
    ie.Document.getElementById("password").Value = "testPW"
 
' Click the "Search" button
    ie.Document.getElementById("enter").Click
 
    Do Until Not ie.Busy And ie.readyState = 4
        DoEvents
    Loop
End Sub
```


----------



## Mark RS (Feb 11, 2019)

Hi Big Lar,

I've changed the ElementId to "email", and added a part of code to click the sign in button.


```
Sub test()
' open IE, navigate to the desired page and loop until fully loaded
    Set ie = CreateObject("InternetExplorer.Application")
    my_url = "app.groupworks.com/#/login"
 
    With ie
        .Visible = True
        .Navigate my_url
        .Top = 50
        .Left = 530
        .Height = 400
        .Width = 400
 
    Do Until Not ie.Busy And ie.readyState = 4
        DoEvents
    Loop
 
    End With
 
' Input the userid and password
    ie.document.getElementById("email").Value = "testID"
    ie.document.getElementById("password").Value = "testPW"
 
' click the sign in button
     Set tags = ie.document.getElementsByTagName("button")
        For Each tagx In tags
         If tagx.innerText = "Sign in" Then
         tagx.Click
        Exit For
    End If
Next
 
    Do Until Not ie.Busy And ie.readyState = 4
        DoEvents
    Loop
End Sub
```


----------



## Big Lar (Feb 11, 2019)

Yea! Thanks Mark RS.

I've attempted to figure this site's ElementId without success.
I believe it would be of great benefit to me and my golf gang.
Any suggestions?

https://denverpremier.ezlinksgolf.com/index.html#/login


----------



## Big Lar (Feb 14, 2019)

Wondering if anyone has a solution to my problem?
I know nothing about HTML(?) or Java script(?)

I'm attempting to use VBA to quickly login to a reservation site:


```
Sub test()
Private Sub CommandButton1_Click()
' open IE, navigate to the desired page and loop until fully loaded
    Set ie = CreateObject("InternetExplorer.Application")
    my_url = "https://denverpremier.ezlinksgolf.com/index.html#/login"
    
 
    With ie
        .Visible = True
        .Navigate my_url
        .Top = 50
        .Left = 530
        .Height = 400
        .Width = 400
 
    Do Until Not ie.Busy And ie.readyState = 4
        DoEvents
    Loop
 
    End With
 
' Input the userid and password
    ie.document.getElementById("Username").Value = "testID"
    ie.document.getElementById("password").Value = "testPW"
 
' click the sign in button
     Set tags = ie.document.getElementsByTagName("button")
        For Each tagx In tags
         If tagx.innerText = "Sign in" Then
         tagx.Click
        Exit For
    End If
Next
 
    Do Until Not ie.Busy And ie.readyState = 4
        DoEvents
    Loop
End Sub
```


----------

