Friday, October 3, 2014

When Should I Create a Macro for a Given Word Task?

A colleague asked me recently when she should create a macro in MS Word for a particular task versus just plowing ahead and doing it the long way. My off the cuff response was, "create a macro if it is going to save you time in the long run", which is less than helpful. How could she know if it would save her time in advance? How much time would it have to save to be worth it.

So, here is the long answer. Check the following XKCD chart, which I keep bookmarked:


http://xkcd.com/1205/

What does this mean? Well, if the task in question is something you do once a day and a macro would save you 5 seconds and you expect that you'll be doing the task daily for the next five years, then you should create the macro if you can do it in less than 2 hours. In other words, even if it takes you an hour to create a macro that only saves 5 second of your time, if it is a task you do daily, then it would be a good time investment. If you only want to amortize the time out over a year, divide by 5, which means you could devote 24 minutes to it and come out ahead.

How long does it take to create a macro. It depends. If you're going to use a macro that just types out a long paragraph or two, then not long at all. The next time you go to type it, simply record it as a macro and you're done. Quickly assign it a shortcut key and you're saving your 5 seconds. And, this should only take an extra minute longer than doing the task by hand, which means you're going to be well within the 2 hour or 24 minute time limit.

If you're going to have to get into the details of VBA and coding a macro, it could be a lot longer, especially if you're not familiar with VBA. I've had a number of times where I go to make something simpler by coding a macro from scratch and I end up burning way more time than it saves because I had to do so much research on how to write the code.

The long and short of it is: if creating the macro is simply a matter of recording what you do, then you should almost always err on the side of recording it. In the long run, you'll probably save time. If it is going to require anything more than that, I'd talk to someone before trying to do it on your own.

No comments:

Post a Comment