Use the record button on the macro toolbar OR Tools > Macro > Record. And then do the steps you want to do. Stop recording the macro once you're done via stop button OR Tools > Macro > Stop. Save the macro. Now open a different program and run this macro via Run button OR Tools > Macro > Run. Check the results under the docuemnt properties in the option.
Why don't you save the dimension style in your template and simply change the selected dimensions to that style.