VBA Automate facebook Post with thumbnail

thirulovableenemy

New Member
Joined
May 31, 2012
Messages
6
Hi,

I'm trying to automate the Facebook post in group - Even I'm almost completed but it is posting only the Text and not the link. When I input text it posts without any problem but when I input links it pops up with error message stating nothing entered in the text box (Autally I want the thumb nail to be displayed thats why I'm give few seconds delay - If I remove the wait time it posts the link without link but I require link with thumb nail). - Please help

Please change the login info

Code:
[COLOR=#333333]Sub Login_facebook()[/COLOR]
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit;">     
    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 = "zzzzzzz"
    ie.document.all.Item("pass").Value = "zzzzzzzzz"
    ie.document.all.Item("login").Click
     Application.Wait (Now + TimeValue("00:00:02"))
    ie.navigate "https://www.facebook.com/groups/496722467127307/"
    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 = "HI" & " " & "http://www.scorphq.com/YouTube/MyPage/xditWVw2ReE.htm"
    
   'ie.document.all.Item("xhpc_message_text").Value = "HI" & " " & "http://www.scorphq.com/YouTube/MyPage/xditWVw2ReE.htm"
    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
    '"http://www.scorphq.com/YouTube/MyPage/xditWVw2ReE.htm
 'Application.Wait (Now + TimeValue("00:00:05"))
    ' ie.document.all.Item("xhpc_message_text").Value = "hi"
    '---------------------------------------------------------


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

    
    
    '---------------------------------------------------------


[FONT=Verdana]End Sub

[/FONT]</code>



Thanks
Thiru
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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