Put your code in the template for the document as macros. Put buttons for the macros on the QAT in the template.
Neither the macros nor the buttons get sent.