Write Your Own Twitter Client using Microsoft Excel

Create named ranges for your data

(this step is not mandatory)

We need just 3 fields of data to post a message to your twitter account. User name, Password and Message . Select each of the 3 cells and create named ranges for them. Name them something meaningful like “tusername”, “tpasswd” and “tmessage”. To create a name for selected cell, just press menu > insert > name > define (press the create name button in excel 2007)
Now, the fun part, writing macro code to post your message to twitter

The actual code is no geek stuff. We will use XMLHTTP object to do our work.

What is xmlhttp? it is the same object your browser uses to dynamically receive and send data from websites. It is the stuff behind all those cool AJAX powered sites.

First, right click on the “tweet” button you have created and select assign macro option. In the window it would show your macroname (tweetThis). Select it and click on edit button. This will open VBA Editor. Don’t freak out.

Our code needs to do the following stuff:

1. Create an xmlhttp object
2. Use twitter API’s post method and post the message
3. Get the status and display it in debug window (just so that we would know if something went wrong)
4. Close the xmlhttp object

I have written the below code, but I am sure you can write your own looking at how simple it is.