Using the Skype API in Excel VBA: Rich mood messages v0.1

Thursday, April 5th, 2007 @ 11:18 pm | internet

After winning a packet of Haribo for having the “most informative Skype mood message” during a recent 9 month project (you can imagine how exciting the other awards were…) I decided that it would be a good idea to continue the practice of updating all-and-sundry with my current location, the weather and my upcoming plans. I also, while musing on this, happened to notice that Skype now supports “rich” mood messages – meaning that you can use basic HTML to add bold and the like. Finally, being a bit of an Excel fan and a follower of Alex Schultz’s blog, I wondered how easy it would be to speak to the Skype API from Excel VBA.

The answer? Really easy.Version 0.1 below – after remembering to reference the Skype4COM dll in VBA (Tools> References…), the following code pulls the current weather (from an Excel webquery which ends up in cell L4 of worksheet) pulls my location from my current Skype IP, and populates my rich Skype mood message. Took about 20 minutes, including reading Alex’s blog, the Skype API docs, and getting a Lemsip.

Dim oSkype As Skype
Set oSkype = CreateObject("Skype4COM.Skype")
ThisWorkbook.Sheets("weather").Cells(2, 2).QueryTable.Refresh BackgroundQuery:=False
oSkype.CurrentUserProfile.RichMoodText = Format(Now(), "dddd d mmmm yyyy") + " | currently in " + oSkype.CurrentUserProfile.IPCountry + " | London weather (" + Format(Now(), "hh:mm") + "): " + ThisWorkbook.Sheets("weather").Cells(4, 12) + " | <i>testing the Excel Skype Mood-a-tron</i>"
Set oSkype = Nothing

See related posts...

  • No related posts found.

2 Responses to “Using the Skype API in Excel VBA: Rich mood messages v0.1”

  1. TomOne Says:

    You are, by a very long way, the biggest geek I have ever called “friend”.

    But then again, which one of us is sitting in front of Photoshop fixing a tiger’s nose at 10:30pm?

  2. Alex Schultz Says:

    Hmmm I have to remember people actually read my blog.
    Nice work Tom :)

Leave a Reply