Customized Ribbon (added via XML) appear twice
发布时间:2026-08-18 | 浏览:6
I have created a template file (dotm) including a customized ribbon which is added from an XML add-in with the Custom UI Editor tool.
The template includes some macros (e.g. for applying a predefined text style) that are linked on the Customized Ribbon/Tabs.
When creating a new document based on the dotm file, a separate docx file is created, the related macros refer to the original dotm file. Of course this setup requires that the original dotm file is somewhere available on the local hard drive or network drive.
In some case it happens, that the XML related information is copied from the original dotm file and added to the docx file - the result is that the customized Ribbon appears twice in the toolbar (once from the XML in the original dotm file and once from the XML in the docx file).
I have to say at the beginning, that I'm not an expert in XML, but the current solution works :-)
When removing the XML information from the docx file (by the Custom UI Editor), the customized Ribbon is just in once - as it should be.
In order to fix the issue, I would now like to know why or at least at which step the XML information is added to the docx file.
Unfortunately the behavior is not existing for all users all the time, it just happens now and then.
Customized Ribbon
XML information
Thanks for your comments!
A family of Microsoft word processing software products for creating web, email, and print documents.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
It sounds like you may be using File>Open to create the document from the template, rather than File>New and then selecting the template, or you have the template stored in the Word Startup folder when it should be stored in the Word Templates folder.
If you are creating a document from the template, it should NOT be stored in the Word Startup Folder, but in the Word Templates folder.
If you use File>New and select a template in the templates folder, the document that is created will not inherit the code or the XML Ribbon Customization in the template, but, because a reference is created to the template, the code and XML Ribbon Customization in the template will be available for use by the template.
4 additional answers
Anonymous 2015-03-12T09:57:06+00:00 I would put the following code in the ThisDocument object of the template Private Sub Document_Open() MsgBox "To use this template, you must use File>New and then select the template" ThisDocument.Close End Sub 0 comments No comments Report
I would put the following code in the ThisDocument object of the template
Private Sub Document_Open()
MsgBox "To use this template, you must use File>New and then select the template"
ThisDocument.Close
Anonymous 2015-03-12T08:07:23+00:00 Unfortunately the issue is not re-producable at any time - at least in my case. Is there a possibility or command to not load the xml information which is copied into the docx file, or even better to delete it by a macro (e.g. when opening the file? Thanks for your inputs. 0 comments No comments Report
Unfortunately the issue is not re-producable at any time - at least in my case.
Is there a possibility or command to not load the xml information which is copied into the docx file, or even better to delete it by a macro (e.g. when opening the file?
Thanks for your inputs.
Anonymous 2015-02-26T11:30:27+00:00 If you must start a document from Windows Explorer or File Explorer, it is better for the file to be a .dotm file as then the default action when it is double-clicked on is for a new document to be created from the template. If it is a .docm file, the default action is to open the file, which could mean that they screw it up and make it unsuitable for future use. 0 comments No comments Report
If you must start a document from Windows Explorer or File Explorer, it is better for the file to be a .dotm file as then the default action when it is double-clicked on is for a new document to be created from the template.
If it is a .docm file, the default action is to open the file, which could mean that they screw it up and make it unsuitable for future use.
Anonymous 2015-02-26T10:52:00+00:00 Many thanks for the hint. Its hard to say how the different users start creating their documents, but it sounds like the recommended procedure is to start with Right click/new, correct? Could you further explain if using a docm file instead of the dotm could be a possible solution to avoid this behavior? I think that when using a docm file, the macro is anyhow used from the file itself and not related to any template. Thanks for your comments. 0 comments No comments Report
Many thanks for the hint.
Its hard to say how the different users start creating their documents, but it sounds like the recommended procedure is to start with Right click/new, correct?
Could you further explain if using a docm file instead of the dotm could be a possible solution to avoid this behavior? I think that when using a docm file, the macro is anyhow used from the file itself and not related to any template. Thanks for your comments.