This is now part of a Google Apps Script shared library you can incorporate in your own project.
Code
This code is at https://gist.github.com/3358690, and the shared Google Apps Script Library can be accessed with the key MEQ3tE5y5_cTOAgUbUKSIAiz3TLx7pV4j
Code
The code is in the mcpher library. See here for how to incorporate it into your project.
Take a look at From VBA to Google Apps Script for more like this.. In the meantime why not join our forum,follow the blog or follow me on twitter to ensure you get updates when they are available.
Transitioning is covered more comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly. It also comes with an extensive VBA-Apps Script equivalence library.