Shorten your tweets with a bit of VBA

The web API madness continues: If you find yourself running out of space on Twitter, Tweetshrink has an API you can use to return a shortened string of whatever you pass to it. You can use this in tandem with the URL shortener and Twitter posting code to create a robust Excel-based Twitter application. I can't believe I just wrote "robust Excel-based Twitter application".

Function FixTweet(txt As String) As String
' based on
Dim xml As Object
  Set xml = CreateObject("MSXML2.XMLHTTP.6.0")

  xml.Open "POST", "" & txt, False

  FixTweet = xml.responsetext
End Function

Sample usage:

Sub TestShrink()
  Debug.Print FixTweet("this is my tweet, I love it!")
End Sub
About JP

I'm just an average guy who writes VBA code for a living. This is my personal blog. Excel and Outlook are my thing, with a sprinkle of Access and Word here and there. Follow this space to learn more about VBA. Keep Reading »

Share This Article:

Share and bookmark this articledelicious buttonfacebook buttonlinkedin buttonstumbleupon buttontwitter button

This article is closed to any future comments.
Peltier Tech Charting Utilities for Excel