Tuesday, December 07, 2010

Gotcha of the Day: Generating a Page of Note Cards from an Excel Doc

A client of mine had a novel idea that involved generating printable note cards from data in database (yes, I'm being intentionally vague here - bare with me). The most obvious way to tackle this sort of thing is to use MS Word Mail Merge.

It's fairly easy to wire a Word Doc into an Excel spreadsheet and include mail merge fields on the page. I ended up with something like this:

The gotcha, is that when I merged the Excel and Word document, I found that each page contained a grid of the same Question and Answer pairs. That is, if my first question was: "How are you?" and the answer was "Good" - then I got "How are you? Good" repeated throughout the page. The second page contained a grid of the second question and so on.

Of course, the goal was to have the question/answer change throughout the page.

And the fix for this? The answer is nestled under the little Rules menu on the Mailings tab. By selecting this menu, you can choose Next Record:

Doing this will insert an instruction into your document, which, as you might suggest, tells Word to look at the next row in Excel. Apparently, Next Record is usually not needed because one is implicitly added when you go to a new page.

The final document now looks something like so:

While I do love my lightweight tools and Google Docs, every once in a while, Word does show off its strength. And merging documents is just one of those tasks.

No comments:

Post a Comment