Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to login to Facebook using code from my Excel as follows:

 Sub CallChrome()
    Set ie = CreateObject("InternetExplorer.application")
        ie.Visible = True
        ie.Navigate ("https://www.fb.com")
        Do
            If ie.ReadyState = 4 Then
                ie.Visible = False
                Exit Do
            Else
                DoEvents
            End If
        Loop
        ie.Document.Forms(0).all("Username").Value = "username"
        ie.Document.Forms(0).all("Password").Value = "password"
        ie.Document.Forms(0).submit

    End Sub

However, it shows an error "Object Required error 424" , on the ie.Document.Forms(0)...... Although the login page is being displayed, I am not able to pass my credentials.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
193 views
Welcome To Ask or Share your Answers For Others

1 Answer

This worked. I replaced this:

    ie.Document.Forms(0).all("Username").Value = "username"
    ie.Document.Forms(0).all("Password").Value = "password"

with this:

    ie.Document.all.Item("email").Value = "username"
    ie.Document.all.Item("pass").Value = "password"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...