View Single Post
 
Old 09-17-2022, 09:02 AM
Cosmo Cosmo is offline Windows Vista Office 2007
Competent Performer
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by Italophile View Post
It has always been the case that when a document is created from a template it inherits the content of the template except:
  • VBA code
  • ribbon xml
  • building blocks
Those items stay in the template and will be available to the document whilst it remains attached to the template.

I rarely build templates that contain customized ribbon code but occasionally it has been necessary. In the interests of science I just created a document from an old template I created for a client that was using Wd2010. I then compared that to an example document I created from the same template back in 2016. To my surprise the new document contained the ribbon xml whilst the old document didn't.

As I am now using O365 I can only conclude that in Microsoft's infinite wisdom they decided to change how this works at some point. Either that or they've introduced a bug.
Ok. So, I'm NOT going crazy. Everything I had read indicated that saving a document from a template would strip out the UI elements, and what you are saying tracks with what I have experienced.

I believe I have a working solution for now, might not be the best but it seems to work to get a usable template for next week. I can update the procedure at a later date if necessary.

When I finish my working template with all code and CustomUI elements, I will make a duplicate of that UI file, strip out the CustomUI elements. The 'Doc-Template.dotm' file will be added to the 'Templates' folder, the 'Doc-Template-UI.dotm' and an alias to the 'Doc-Template.dotm' file will be added to the 'Startup' folder. I have adjusted the code to create a new document from the UI to search the Application.Templates for the correct template file instead of using 'ThisDocument' so that it will use the non-UI template. This allows me to maintain a single template that has all elements necessary for that specific document.

This does mean that there are 2 templates with identical code, but that's not an issue to me. The only issue would be if i need to submit an update to the template, and someone updates one but not the other. This shouldn't be a problem for PC users, as I will be creating an installer to handle that, but for now, i will need Mac users to update the files manually. I will need to look into a similar process for Mac.

Thanks for the assistance, I will look more into the Templates discussion Charles linked to earlier when I have more time to dedicate.
Reply With Quote