Make your Office add-in version-independent

Friday, July 25th, 2008 286 views

    If you are working on code for any Office application, you might need to reference an object library for another Office application. I've been working on code for a new add-in for Excel, and needed to write code that would reference the appropriate object library, depending on the version of ...

Format header row

Friday, July 11th, 2008 226 views

So I was getting tired of constantly formatting the header row on whatever spreadsheet I am working on, hence this short sub was born. It pretties up the header row and adds autofilter arrows. Most importantly it autosizes the columns so all the information is visible. I chose Teal (ColorIndex ...

Calculate Working Hours in VBA

Tuesday, June 24th, 2008 2,572 views

In the spirit of my last post Calculate Working Days Minus Holidays in VBA, here is a function I wrote recently that returns the number of working hours between two date/time values passed to the function as arguments. It is self-contained and works independently of whatever existing code you have, ...

XML Parsing Function

Wednesday, May 28th, 2008 186 views

In keeping with my Website XML parsing post, here is a short function that returns the body text from a webpage as a string, on which you can use other functions like Instr, Left$, Mid$, etc, to extract necessary data. [vba] Function URLText(sURL As String) As String ' check website.com using xml ' early ...

Hands Off That Email Attachment!

Monday, April 14th, 2008 313 views

About halfway down the Outlook page, there is some VBA code for opening an Excel workbook attached to an email, running a macro on it, then cleaning up and moving the email to another folder. Here is some more sample code to make your macro even more intelligent. This code opens ...