Hi,
I've found solutions elsewhere that can log into Facebook using Excel VBA, but cannot get it to work:
Sub facebookPost()
Dim ie As Object
Dim sUser As String, sPass As String
'~~> Change as Applicable
sUser = "someone@somewhere.com"
sPass = "password1234"
Set ie = CreateObject("INTERNETEXPLORER.Application")
ie.navigate ("www.Facebook.com")
ie.Visible = True
Do While ie.Busy: DoEvents: Loop
Application.Wait (Now + TimeValue("00:00:02"))
' The following line gives an error if I am already logged into facebook in another window. How can I test for this and workaround?
ie.document.All.Item("email").Value = sUser
ie.document.All.Item("pass").Value = sPass
ie.document.All.Item("loginbutton").Click
Do While ie.Busy: DoEvents: Loop
Application.Wait (Now + TimeValue("00:00:02"))
' The following line creates error 91. What am I doing wrong?
ie.document.All.Item("status").Select
ie.document.All.Item("u_0_10").Value = "Hello World"
' What code do I need to click the "Post" button?
' What code do I need to confirm that the posting was successful?
' What code do i need to log out of facebook and close the IE window?
End Sub
any help appreciated
I've found solutions elsewhere that can log into Facebook using Excel VBA, but cannot get it to work:
Sub facebookPost()
Dim ie As Object
Dim sUser As String, sPass As String
'~~> Change as Applicable
sUser = "someone@somewhere.com"
sPass = "password1234"
Set ie = CreateObject("INTERNETEXPLORER.Application")
ie.navigate ("www.Facebook.com")
ie.Visible = True
Do While ie.Busy: DoEvents: Loop
Application.Wait (Now + TimeValue("00:00:02"))
' The following line gives an error if I am already logged into facebook in another window. How can I test for this and workaround?
ie.document.All.Item("email").Value = sUser
ie.document.All.Item("pass").Value = sPass
ie.document.All.Item("loginbutton").Click
Do While ie.Busy: DoEvents: Loop
Application.Wait (Now + TimeValue("00:00:02"))
' The following line creates error 91. What am I doing wrong?
ie.document.All.Item("status").Select
ie.document.All.Item("u_0_10").Value = "Hello World"
' What code do I need to click the "Post" button?
' What code do I need to confirm that the posting was successful?
' What code do i need to log out of facebook and close the IE window?
End Sub
any help appreciated