Thank you, I had the same need and this was perfect! Once in the help, I had to select topic named "Replace with template" and it had detailed example just exactly how you described. And as Michael Staszewski noted, you can use the Advanced macro editor feature and create a macro group, which will be a sequence of editor macros executed in order.
Kennon123: you should mark this as the answer.