I think this macro should do the trick, or at least show you an example you can build on:
For more information, see the wiki Searching the Forum for Answers section.