The ribbon code needs to be a valid text file that gets inserted inside a document or template. Typically this is done by using a third party tool which also creates the additional references in associated embedded files.
I don't know how to use vba to inject the ribbon code inside a Word document so I can't help you with that. Some useful references to get you started are:
http://www.softpedia.com/get/Program...n-Editor.shtml
http://gregmaxey.com/word_tip_pages/...bbon_main.html