They say you learn something new every day.

Archive for August, 2012

Outlook Items (31/08/2012)

I recently needed to load an eMail in Outlook with a particular set of users in the to field. I was going to do it with a “mailto:” link, but then discovered this neat bit of vbscript for automating sending eMails with Outlook.

FUNCTION SendEmail()

 set objOutlk = createobject(“Outlook.Application”)
 set objMail = objOutlk.createitem(0) = to
 set objMail = nothing
 set objOutlk = nothing


Letters to Numbers (30/08/2012)

I had to convert a letter to a number today. Weird I know, but basically I needed the letter’s numeric position in the alphabet – so A is 1, B is 2, Z is 26 and so on.

It’s simple enough in theory, but unless you’re going to create a function to lookup and return the correct number it’s a bit messy. There’s probably a neater way of using split() and returning the array index, but I couldn’t figure it out.

Just when I was about to do a horrible:

IF n = “A” THEN n = 1

IF n = “Z” THEN n = 26 

I can across the function ASC() in vbscript, which gets the ASCII value. It turns out with a little bit of tweaking you can create a simple conversion function:

FUNCTION ConvertToNumber(n)

   ConvertToNumber = Asc(ucase(n)) – 64


It’s not something you’d use that often, but it saves a lot of time when you do need it. 

Splitting Tickets (19/08/2012)

I’ve often thought that if there’s one thing I’m good at, it’s finding the cheapest way to buy things.

I was a bit shocked, then, when I came across the idea of “splitting” your train ticket. It turns out, I’ve been overpaying on tickets for years.

For example, a ticket from Tottenham Hale to Bishop Stortford, and a another ticket from Bishop Stortford to Stansted Airport, is cheaper than buying a direct ticket from Tottenham Hale to Stansted Airport. It’s the same train – even the same seat.

Crazy, I know, but it means it’s something else I’m going to have to check before buying new tickets. 

Tag Cloud