Tweet from Excel

paulmc1981

New Member
Joined
Jan 16, 2017
Messages
9
Hi, I have an extremely tight deadline (Monday) to create a spreadsheet with 2 sheets, 1 tab with have the twitter constants and the second tab will have a button that will post what ever is in "A1" to the given twitter account from the constants on the first tab.

Does anyone have something that they can attach to here to help out? Sorry I do not have any code that I have tried as this appears to be over my head.

Thanks in advance for any replies.
 

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
google tweet from excel and find several options available to you
 
Upvote 0
Just tried this code and it did not work :(

Option Explicit
Sub tweetusing_VBA()
' tools refrence select microsoft internet control
Dim ie As Object
Dim linkCollection, link
Set ie = CreateObject("InternetExplorer.application")


' open website


ie.Visible = True
ie.navigate "https://mobile.twitter.com/compose/tweet"
Do Until ie.readyState = 4
DoEvents
Loop


' login
Set linkCollection = ie.document.getElementsByTagName("input")
' check if user is already login if not then pass user id and password


For Each link In linkCollection
If UCase(link.Name) = UCase("username") Then
ie.document.getElementById("username").Value = Sheet1.user_name
ie.document.getElementById("password").Value = Sheet1.pass_word
ie.document.getElementById("commit").Click
Exit For
End If
Next




Do Until ie.readyState = 4
DoEvents
Loop


Application.Wait (Now + TimeValue("0:00:3"))
Set linkCollection = ie.document.getElementsByTagName("div")
' check if user is already login if not then pass user id and password
For Each link In linkCollection
If UCase(Left(link.innerText, 27)) = UCase("Typing on your phone stinks") Then
MsgBox "Check ID and Password"
ie.Quit
Exit Sub
End If
Next




' post tweeet
If Len(Sheet1.mess_age) > 140 Then
ie.document.getElementById("tweet[text]").Value = Left(Sheet1.mess_age, 140)
Else
ie.document.getElementById("tweet[text]").Value = Sheet1.mess_age
End If


Do Until ie.readyState = 4
DoEvents
Loop




Application.Wait (Now + TimeValue("0:00:3"))
ie.document.getElementById("commit").Click
Application.Wait (Now + TimeValue("0:00:3"))

Do Until ie.readyState = 4
DoEvents
Loop




ie.navigate "https://mobile.twitter.com/"


Do Until ie.readyState = 4
DoEvents
Loop


Application.Wait (Now + TimeValue("0:00:3"))
ie.document.getElementById("commit").Click
Do Until ie.readyState = 4
DoEvents
Loop

ie.Quit
Sheet1.pass_word.Value = ""
Sheet1.mess_age.Value = ""
MsgBox "Tweet Sent"
End Sub
 
Upvote 0
Does not work is not helpful. Do you get an error message? If so, what did it say? and if you did, click on Debug and advise what line of code is highlighted. Did you compile your code? Any error messages? Did you step through the code -- open and click on F8 to step through. I cannot do any of these because I don't tweet. Therefore you will have to do the diagnostics.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,334
Members
449,077
Latest member
Jocksteriom

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