View Single Post
 
Old 09-17-2022, 07:50 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

My experience with CustomUI ribbons and templates has been to always put the code (vba and customUI) into the 'attached' template because that is where the applicability matches and there is rarely a reason to complicate the system by implementing partner addins to match the 'attached' template.

However I have seen particular users create documents from templates which accidently get a copy of the CustomUI embedded in the docx file. This happens when their workflow is to OPEN the template and then do a SaveAs to turn it into a docx file. In this special case the CustomUI xml is included in the docx file although any macros would be stripped out as they save unless they choose docm as the format.

I have not yet seen a template with embedded customUI code produce new documents with contained customUI when the documents are created the RIGHT way (File>New or double clicking a dotm file). It is possible that this functionality has been broken on a recent update of Word 365 but I still haven't seen it.

I do wonder why you would put the source new document template in your startup folder instead of the more usual User/Workgroup templates folder. This might be interfering with the code you say you are using
Code:
Application.Documents.Add(Template:=ThisDocument.FullName, visible:=True)
Is that creating an unsaved DocumentX file or is it opening the template itself which you then SaveAs? Opening the template would cause the CustomUI to be replicated in the resulting file.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote