Adding code to a template doesn't really work in PowerPoint. The way to do this is to create an AddIn with a ribbon button so that the code is alway available.
There's a learning curve of course but we have some pointers on
our site here
Right at the bottom there is also a free AddIn kit that may help.