FaceBook Login

klatlap

Well-known Member
Joined
Sep 1, 2004
Messages
607
Office Version
  1. 2013
Platform
  1. Windows
Wondering if someone is willing to get this code working for me, i tested it with my details and mostly works, but doesn't submit a post, i am not even sure if you need the IE to be visible to do this, i guess it needs some error checking also, or you could logout then destroy the ie window ready for the next update.

Code:
Sub Login_facebook()
     
    Dim ie As Object
     
     Dim aelement
     Dim btnInput
     Dim btnInputer
     
    Set ie = CreateObject("InternetExplorer.Application")
     
    ie.navigate "http://www.facebook.com/login.php"
     
    ie.Visible = True
     
    Do While ie.Busy And Not ie.readyState = 4
        DoEvents
    Loop
     
    DoEvents
     
    ie.document.all.Item("email").Value = "Your Email"
    ie.document.all.Item("pass").Value = "Your Password"
    ie.document.all.Item("login").Click
     Application.Wait (Now + TimeValue("00:00:02"))
    ie.navigate "Your Facebook Page"
    Do While ie.Busy And Not ie.readyState = 4
        DoEvents
    Loop

    Application.Wait (Now + TimeValue("00:00:05"))
    
           Set ElementCol = ie.document.getElementsByClassName("_4j _519b")

 For Each btnInput In ElementCol
    btnInput.Click
 Next btnInput
     
    ie.document.all.Item("xhpc_message_text").Click
    Dim VALUER As String
    
    VALUER = Sheets("FB").Range("A1").Value
    
   
    ie.document.all.Item("xhpc_message_text").Value = VALUER
    Set ElementCol = ie.document.getElementsByClassName("_4j _519b")

 For Each btnInput In ElementCol
    btnInput.Click
 Next btnInput
    
Set ElementColumer = ie.document.getElementsByClassName("_42ft _4jy0 _11b _4jy3 _4jy1 selected _51sy")

For Each btnInputer In ElementColumer
    btnInputer.Click
 Next btnInputer
     


 
 Application.Wait (Now + TimeValue("00:00:10"))
   Set inputcollection = ie.document.getElementsByTagName("button")
  For Each aelement In inputcollection
If aelement.getAttribute("class") = "_42ft _4jy0 _11b _4jy3 _4jy1 selected _51sy" Then
aelement.Click
GoTo 10
End If
Next
10
    
    
   


End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top